You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a fresh virtual env where I am trying to exec an onnx model like so:
# Load Locally Saved ONNX Model and use for inference
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForCustomTasks
sentence = "This is a test sentence."
local_onnx_model = ORTModelForCustomTasks.from_pretrained("./model_onnx")
tokenizer = AutoTokenizer.from_pretrained("./model_onnx")
inputs = tokenizer(
sentence,
padding="longest",
return_tensors="np",
)
outputs = local_onnx_model.forward(**inputs)
print(outputs)
but I keep getting this massively annoying circular dependency error:
File "/home/foo/miniconda3/envs/aaa/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1512, in _get_module
raise RuntimeError(
RuntimeError: Failed to import optimum.onnxruntime.modeling_ort because of the following error (look up to see its traceback):
Failed to import optimum.onnx.graph_transformations because of the following error (look up to see its traceback):
Failed to import optimum.exporters.onnx.__main__ because of the following error (look up to see its traceback):
cannot import name 'TasksManager' from partially initialized module 'optimum.exporters' (most likely due to a circular import) (/home/foo/miniconda3/envs/aaa/lib/python3.10/site-packages/optimum/exporters/__init__.py)
It is literally a fresh environment and I train test with no issues.
Lost to as to why this is - also tried different machines, different ve's, also installed from source etc...
### Who can help?
_No response_
### Information
- [X] The official example scripts
- [X] My own modified scripts
### Tasks
- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)
### Reproduction (minimal, reproducible, runnable)
Just the code above.
### Expected behavior
It should run!
The text was updated successfully, but these errors were encountered:
System Info
but I keep getting this massively annoying circular dependency error:
It is literally a fresh environment and I train test with no issues.
Lost to as to why this is - also tried different machines, different ve's, also installed from source etc...
The text was updated successfully, but these errors were encountered: