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

optimum-cli export onnx error with sentence-transformers #2052

Closed
2 of 4 tasks
marcovzla opened this issue Oct 10, 2024 · 1 comment · Fixed by #2053
Closed
2 of 4 tasks

optimum-cli export onnx error with sentence-transformers #2052

marcovzla opened this issue Oct 10, 2024 · 1 comment · Fixed by #2053
Assignees
Labels
bug Something isn't working

Comments

@marcovzla
Copy link

System Info

$ pip freeze | grep optimum
optimum==1.23.0

$ python -V
Python 3.11.2

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

Who can help?

@michaelbenayoun

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)

$ optimum-cli export onnx \
    --framework pt \
    --model sentence-transformers/all-mpnet-base-v2 \
    --task feature-extraction \
    onnx/sentence-transformers_all-mpnet-base-v2
Using the export variant default. Available variants are:
    - default: The default ONNX variant.
Traceback (most recent call last):
  File "/home/marcov/.virtualenvs/onnx/bin/optimum-cli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/marcov/.virtualenvs/onnx/lib/python3.11/site-packages/optimum/commands/optimum_cli.py", line 208, in main
    service.run()
  File "/home/marcov/.virtualenvs/onnx/lib/python3.11/site-packages/optimum/commands/export/onnx.py", line 265, in run
    main_export(
  File "/home/marcov/.virtualenvs/onnx/lib/python3.11/site-packages/optimum/exporters/onnx/__main__.py", line 374, in main_export
    onnx_export_from_model(
  File "/home/marcov/.virtualenvs/onnx/lib/python3.11/site-packages/optimum/exporters/onnx/convert.py", line 1130, in onnx_export_from_model
    if model.can_generate() and len(misplaced_generation_parameters) > 0:
       ^^^^^^^^^^^^^^^^^^
  File "/home/marcov/.virtualenvs/onnx/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1729, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'SentenceTransformer' object has no attribute 'can_generate'

Expected behavior

This used to work on optimum 1.22.0

@marcovzla marcovzla added the bug Something isn't working label Oct 10, 2024
@echarlaix echarlaix self-assigned this Oct 11, 2024
@echarlaix
Copy link
Collaborator

Hi @marcovzla, thanks for reporting, a fix was included in #2053 and will be part of a patch release planned for today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants