Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuget for Linux #273

Closed
luisquintanilla opened this issue Apr 19, 2024 · 15 comments
Closed

Nuget for Linux #273

luisquintanilla opened this issue Apr 19, 2024 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@luisquintanilla
Copy link
Member

luisquintanilla commented Apr 19, 2024

When trying out a samples that uses Phi in .NET, I get the following error.

Unhandled exception. System.DllNotFoundException: Unable to load shared library 'onnxruntime-genai' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libonnxruntime-genai: cannot open shared object file: No such file or directory

Full Stack Trace:

Hello From Phi-2
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'onnxruntime-genai' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libonnxruntime-genai: cannot open shared object file: No such file or directory
   at Microsoft.ML.OnnxRuntimeGenAI.NativeMethods.OgaCreateModel(Byte[] configPath, IntPtr& model)
   at Microsoft.ML.OnnxRuntimeGenAI.Model..ctor(String modelPath)
   at Program.<Main>$(String[] args) in /workspaces/ort-genai-phi2/ORTGenAIPhi/Program.cs:line 8

Repo: https://github.com/luisquintanilla/ort-genai-phi2

@baijumeswani
Copy link
Contributor

@luisquintanilla Could you share your platform details (are you using windows)?

Were you able to install the nuget package successfully? Are you downloading the package from nuget.org?

@luisquintanilla
Copy link
Member Author

luisquintanilla commented Apr 19, 2024

@baijumeswani I am on Windows. However, I'm using devcontainers.

Here is my configuration:

https://github.com/luisquintanilla/ort-genai-phi2/blob/main/.devcontainer.json

System Info:

  • Debian
  • Python 3.10
  • .NET 6
  • Intel CPU

Let me know if you need anything else.

I also have an NVIDIA RTX 3080. However, I also get this issue on the CPU. So to keep things simple, let's assume CPU only.

@baijumeswani
Copy link
Contributor

We have not published the nuget binaries for linux yet. This will be supported in future releases but is not supported right now.

@pksorensen
Copy link

I got the same error on windows, with nuget packages.

 var a = new Microsoft.ML.OnnxRuntimeGenAI.Model(@"C:\dev\hugginfacecli\multilingual-e5-large\onnx");
Unhandled exception. System.DllNotFoundException: Unable to load DLL 'onnxruntime-genai' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at Microsoft.ML.OnnxRuntimeGenAI.NativeMethods.OgaCreateModel(Byte[] configPath, IntPtr& model)
   at Microsoft.ML.OnnxRuntimeGenAI.Model..ctor(String modelPath)
   at TestLocalEmbed.Program.Main(String[] args) in C:\dev\TestLocalEmbed\TestLocalEmbed\Program.cs:line 149
   at TestLocalEmbed.Program.<Main>(String[] args)

@imxcstar
Copy link

I also encountered the same error when loading phi-3, but it occurred during cuda and was normal on CPU

@baijumeswani
Copy link
Contributor

I also encountered the same error when loading phi-3, but it occurred during cuda and was normal on CPU

For CUDA, make sure your CUDA binaries are discoverable by adding them to your PATH.
For example, for me the cuda binaries are located in: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin and this path should be added to your PATH env variable.

@rhenry74
Copy link

at Microsoft.ML.OnnxRuntimeGenAI.NativeMethods.OgaCreateModel(Byte[] configPath, IntPtr& model)
at Microsoft.ML.OnnxRuntimeGenAI.Model..ctor(String modelPath)
at OnnxGenAI.Program.Main(String[] args) in C:\Users\rhenr\source\repos\OnnxGenAI\OnnxGenAI\Program.cs:line 42

i don't have nvidia, just want to run on CPU

@HowardvanRooijen
Copy link

I got the same error experimenting on a Surface Studio Laptop 2 on Windows, but discovered I could get past this error by ensuring I had both references:

<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI" Version="0.2.0-rc4" />
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.Cuda" Version="0.2.0-rc4" />

@luisquintanilla
Copy link
Member Author

luisquintanilla commented May 30, 2024

Still running into issues on Windows with version 0.3.0-rc2.

Here's the error I'm getting.

C:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1426 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Dev\ort-genai-phi2\ORTGenAIPhi\bin\Debug\net8.0\runtimes\win-x64\native\onnxruntime_providers_cuda.dll"

I'm using the Phi-3 model. https://huggingface.co/microsoft/Phi-3-mini-4k-instruct

With FP16 CUDA

My code is still the same. The only thing that changed was the model I'm using.

@baijumeswani baijumeswani changed the title [C# Phi-2] System.DllNotFoundException: Unable to load shared library 'onnxruntime-genai' or one of its dependencies. Nuget for Linux Jun 6, 2024
@baijumeswani baijumeswani self-assigned this Jun 6, 2024
@baijumeswani baijumeswani added the enhancement New feature or request label Jun 6, 2024
@arthurvb
Copy link

We have not published the nuget binaries for linux yet. This will be supported in future releases but is not supported right now.

That would be perfect, especially for the Cuda version.

@L-Sypniewski
Copy link

L-Sypniewski commented Jul 10, 2024

Just to make sure - currently there's no way of running apps using onnxruntime-genai on Linux purely with Nuget packages (either CPU or GPU)?
I've been trying to run the example app from https://github.com/microsoft/Phi-3CookBook/tree/main/md/07.Labs/Csharp/src since yesterday, I thought I had some issues on a system level.
If I read the support matrix correctly, it suggests Linux is supported.

@skyline75489
Copy link
Contributor

@L-Sypniewski Work is being done to support NuGet scenarios on Linux. I'm not sure if it can make it in 0.4.0, though.

@skyline75489
Copy link
Contributor

0.4.0-rc1 NuGet package is out with Linux-x64 support. Feel free to check it out: https://www.nuget.org/packages/Microsoft.ML.OnnxRuntimeGenAI/0.4.0-rc1

I'll close this for now.

@HowardvanRooijen
Copy link

0.4.0-rc1 NuGet package is out with Linux-x64 support. Feel free to check it out: https://www.nuget.org/packages/Microsoft.ML.OnnxRuntimeGenAI/0.4.0-rc1

I'll close this for now.

I'm seeing dependencies on packages I can't resolve via nuget.org

image

@baijumeswani
Copy link
Contributor

I'm seeing dependencies on packages I can't resolve via nuget.org

Please add the Ort-Nightly index as a source. You can find more instructions here: https://onnxruntime.ai/docs/genai/howto/install.html#pre-requisites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants