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

Is there a way to optimize transfomers backend binary size? #37

Open
yupm opened this issue May 2, 2023 · 2 comments
Open

Is there a way to optimize transfomers backend binary size? #37

yupm opened this issue May 2, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@yupm
Copy link

yupm commented May 2, 2023

Hello..
Currently I am trying to bundle a deb package for Poricom which uses manga_ocr.
However, the torch dependencies of the transformers backend are making the deb excessively large.

$ find . -type f -size +50M -exec du -sh {} \;

318M    ./opt/poricom/libcublasLt.so.11
145M    ./opt/poricom/libcublas.so.11
179M    ./opt/poricom/unidic_lite/dicdir/sys.dic
69M     ./opt/poricom/unidic_lite/dicdir/matrix.bin
438M    ./opt/poricom/libcudnn_cnn_infer.so.8
88M     ./opt/poricom/libcudnn_ops_infer.so.8
57M     ./opt/poricom/assets/languages/chi_tra.traineddata
526M    ./opt/poricom/torch/lib/libtorch_cpu.so
253M    ./opt/poricom/torch/lib/libtorch_cuda_cpp.so
728M    ./opt/poricom/torch/lib/libtorch_cuda_cu.so

I wonder if you could advise or help regarding reducing the size of the bundle by using another backend such as TF or JAX.

@kha-white kha-white added the enhancement New feature or request label May 7, 2023
@kha-white
Copy link
Owner

It's not a priority for me right now, but I agree that it would be nice to drop the torch dependency. Another option is ONNX.

@HighLiuk
Copy link

Hey there @yupm I'm currently trying to replicate MangaOcr outside of python so I can give you some hints. You can find here #45 a way to export an ONNX model and drop both the transformers & torch dependencies. However consider that this model alone (ONNX file) is more than 500M and I guess you cannot lower that.

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

3 participants