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

NameError: name '_SENTENCE_TRANSFORMERS_TASKS_TO_MODEL_LOADERS' is not defined #1997

Open
2 of 4 tasks
purejomo opened this issue Aug 25, 2024 · 1 comment
Open
2 of 4 tasks
Labels
bug Something isn't working onnx Related to the ONNX export

Comments

@purejomo
Copy link

purejomo commented Aug 25, 2024

System Info

python 3.10.14
torch 2.4.0+cu121
optimum  1.21.4  
onnx                      1.16.2  
onnxruntime               1.19.0    
transformers              4.43.4  

optimum-cli export onnx --model distilbert/distilbert-base-uncased-distilled-squad distilbert_base_uncased_squad_onnx/

when I try to do simple example above, this error happened.

.../optimum/exporters/tasks.py", line 268, in TasksManager
"sentence_transformers": get_model_loaders_to_tasks(_SENTENCE_TRANSFORMERS_TASKS_TO_MODEL_LOADERS),
NameError: name '_SENTENCE_TRANSFORMERS_TASKS_TO_MODEL_LOADERS' is not defined

In "task.py" file, I touhgt _SENTENCE_TRANSFORMERS_TASKS_TO_MODEL_LOADERS is defined already.

image
image

Who can help?

@philschmid @michaelbenayoun @JingyaHuang, @echarlaix

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction (minimal, reproducible, runnable)

python 3.10.14
torch 2.4.0+cu121
optimum 1.21.4
onnx 1.16.2
onnxruntime 1.19.0
transformers 4.43.4

Expected behavior

error should be figured out.
I'm trying to convert hf-llama model to onnx for graph optimization

@purejomo purejomo added the bug Something isn't working label Aug 25, 2024
@echarlaix
Copy link
Collaborator

Hi @purejomo,

I was unfortunately not able to reproduce the error you're describing. Yes _SENTENCE_TRANSFORMERS_TASKS_TO_MODEL_LOADERS is defined in https://github.com/huggingface/optimum/blob/v1.21.4/optimum/exporters/tasks.py#L201-L204, could it be that in your case is_torch_available https://github.com/huggingface/optimum/blob/v1.21.4/optimum/exporters/tasks.py#L156 returns False?

@dacorvo dacorvo added the onnx Related to the ONNX export label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working onnx Related to the ONNX export
Projects
None yet
Development

No branches or pull requests

3 participants