huggingface / optimum

🚀 Accelerate training and inference of 🤗 Transformers and 🤗 Diffusers with easy to use hardware optimization tools
https://huggingface.co/docs/optimum/main/
Apache License 2.0
2.57k stars 469 forks source link

SentenceTransformer to tflite export failure #1982

Open TalonBvV opened 3 months ago

TalonBvV commented 3 months ago

System Info

Please see below the two commands I tried to use.

1) optimum-cli export tflite --model BAAI/bge-m3  --quantize int8-dynamic --sequence_length 2048 --batch_size 10 bge-m3-tflite/

2) python -m optimum.exporters.tflite --model BAAI/bge-m3 --quantize int8-dynamic --sequence_length 2048 --batch_size 10 bge-m3-tflite/

Here is the error I get:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python\Lib\site-packages\optimum\exporters\tflite\__main__.py", line 148, in <module>
    main()
  File "C:\Python\Lib\site-packages\optimum\exporters\tflite\__main__.py", line 61, in main
    model = TasksManager.get_model_from_task(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\optimum\exporters\tasks.py", line 1945, in get_model_from_task
    model_class = TasksManager.get_model_class_for_task(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\optimum\exporters\tasks.py", line 1345, in get_model_class_for_task
    tasks_to_model_loader = TasksManager._LIBRARY_TO_TF_TASKS_TO_MODEL_LOADER_MAP[library]

Who can help?

No response

Information

Tasks

Reproduction (minimal, reproducible, runnable)

1) optimum-cli export tflite --model BAAI/bge-m3 --quantize int8-dynamic --sequence_length 2048 --batch_size 10 bge-m3-tflite/

2) python -m optimum.exporters.tflite --model BAAI/bge-m3 --quantize int8-dynamic --sequence_length 2048 --batch_size 10 bge-m3-tflite/

Expected behavior

I expect it to export the tflite model.

TalonBvV commented 3 months ago

Here are my dependency versions: 1) optimum version: 1.21.2 2) python version: 3.12 3) tensorflow version: 2.17.0

TalonBvV commented 3 months ago

I have repeated my export process in colab and the result is the same.