Description
Describe the bug
When I build or publish linux-x64 binary with Microsoft.ML.OnnxRuntimeGenAI.Cuda 0.5.2
, the final output folder will contain many unnecessary DLLs (onnxruntime*.dll
), especially onnxruntime_providers_cuda.dll
which is very large (>600MB)
Could you please fix to stop publishing these onnxruntime*.dll
files for linux-x64 when dotnet build/dotnet publish
, otherwise the final binaries size will be double (both cuda.so and cuda.sll >600MB)
To Reproduce
Steps to reproduce the behavior:
- test.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<IsPackable>false</IsPackable>
<SelfContained>true</SelfContained>
</PropertyGroup>
<!-- OnnxRuntime for Linux -->
<ItemGroup>
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.Managed" Version="0.5.2" />
<PackageReference Include="Microsoft.ML.OnnxRuntimeGenAI.Cuda" Version="0.5.2" />
</ItemGroup>
</Project>
- Program.cs
namespace MyTest;
using Microsoft.ML.OnnxRuntime;
public class Program
{
public static async Task Main(string[] args)
{
const string modelPath = "/home/jiaxuwu/.aitk/models/onnx/cuda/mistral-7b-instruct-v0.2-cuda-int4-rtn-block-32/mistral-7b-instruct-v0.2-cuda-int4-rtn-block-32.onnx";
using var session = new InferenceSession(modelPath);
}
}
dotnet publish test.csproj --runtime linux-x64
ll -h bin/Release/net8/linux-x64/publish/onnxruntime*.dll
ll -h bin/Release/net8/linux-x64/onnxruntime*.dll
Expected behavior
Microsoft.ML.OnnxRuntimeGenAI.Cuda
shouldn't publish any unnecessary very large files on Linux
Desktop (please complete the following information):
- OS: WLS(Windows Subsystem for Linux)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
- .NET
$ dotnet --list-sdks
8.0.110 [/usr/lib/dotnet/sdk]
- Nuget Package Version:
Microsoft.ML.OnnxRuntimeGenAI.Cuda 0.5.2
Additional context
Another package Microsoft.ML.OnnxRuntimeGenAI 0.5.2
has the similar issue on MacOS
MacOS final output binaries will also contain several unnecessary DLL files with Microsoft.ML.OnnxRuntimeGenAI 0.5.2