-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The following code produces an error:
import timm
from timm.utils.onnx import onnx_export
model_name = "bat_resnext26ts.ch_in1k"
timm_model = timm.create_model(model_name, exportable=True)
timm_model.eval()
onnx_model = onnx_export(
model=timm_model,
output_file=f"{model_name}.onnx"
)
results in
Traceback (most recent call last):
File "[file-path].py", line 7, in <module>
onnx_model = onnx_export(
^^^^^^^^^^^^
File "[dir-path]/venv/lib64/python3.12/site-packages/timm/utils/onnx.py", line 83, in onnx_export
torch_out = torch.onnx._export(
^^^^^^^^^^^^^^^^^^
AttributeError: module 'torch.onnx' has no attribute '_export'. Did you mean: 'export'?
To Reproduce
Steps to reproduce the behavior:
0. Install python 3.12.8
pip install torch==2.6.0 timm==1.0.14 onnx==1.17.0
- Run the above code
Expected behavior
The code should export the model without errors (most likely by using torch.onnx.export
instead of torch.onnx._export
Desktop (please complete the following information):
- OS: Linux, RHEL 8
- TIMM version: 1.0.14
Additional context
I tried replacing _export
with export
and it worked for me.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working