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

Linux version includes both libonnxruntime.so and onnxruntime.dll files, resulting in larger package size #546

Closed
Izumiko opened this issue Dec 30, 2024 · 10 comments

Comments

@Izumiko
Copy link

Izumiko commented Dec 30, 2024

After investigating the Docker image build process, I found that the Linux version of the server package (from the GitHub Actions artifacts) contains both libonnxruntime.so and onnxruntime.dll files, as well as onnxruntime_providers_* files. This results in the Linux package being around 500MB larger than the Windows package.

Are the onnxruntime.dll and onnxruntime_providers_*.dll necessary in the Linux version?

@Webreaper
Copy link
Owner

They're required for the ONNX AI stuff to work, as far as I'm aware. Whether it's possible to trim any of them, I'm unsure - it would take some time-consuming experimentation to work it out, and TBH, I'm not sure it's worth the time at the moment.

They only reason they're not required on Windows is that Windows has the ONNX runtime included by default.

@Izumiko
Copy link
Author

Izumiko commented Dec 30, 2024

Yes, I know Windows could have the runtime.

I mean, the Linux package contains both the Windows onnx runtime onnxruntime*.dll and the Linux onnxruntime libonnxruntime*.so. But the Windows package only contains the Windows onnx runtime onnxruntime*.dll (not use the runtime from the system).

So it may be a packaging error. if the windows version onnxruntime is removed, the package size will be reduced from 1.6G to 1.1G.

@Izumiko
Copy link
Author

Izumiko commented Dec 30, 2024

I found the bug reported at microsoft/onnxruntime-genai#1135, there is a workaround in it.
BTW, it also affects the mac version.

@Webreaper
Copy link
Owner

Webreaper commented Dec 30, 2024 via email

Webreaper added a commit that referenced this issue Dec 30, 2024
@Webreaper
Copy link
Owner

Tagging this issue so it's linked to the MSFT one: microsoft/onnxruntime#23077

@Webreaper
Copy link
Owner

Tried the workaround, but no joy - it doesn't work for single-file publishing. :(

Hopefully MSFT will fix it soon in the new year!

@Izumiko
Copy link
Author

Izumiko commented Dec 31, 2024

Tried the workaround, but no joy - it doesn't work for single-file publishing. :(

Perhaps you could try deleting these DLLs for the Linux and macOS platforms in the makeserver.sh file before zipping the $outputdir.

And I noticed the Emgu.CV.runtime.ubuntu.20.04-x64 package. If we upgrade the base image to 24.04, will the Emgu runtime need to be upgraded as well?

@Webreaper
Copy link
Owner

The EMGUCV stuff isn't used any more, so I'll look at cleaning that up....

@Izumiko
Copy link
Author

Izumiko commented Dec 31, 2024

There is a typo in

linux | max | m1)

@Webreaper
Copy link
Owner

Are you stalking me? 😄

Fixed. It's looking much better now - image size down from 1.2GB to 721MB. 😮

Thanks for your input with this, it's much appreciated. I'll do some testing today, and if nothing has broken, so a proper release sometime later today or tomorrow.

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

No branches or pull requests

2 participants