optimum icon indicating copy to clipboard operation
optimum copied to clipboard

Unexpected arguments `trust_remote_code` when exporting model to onnx with option `--library sentence_transformers`

Open chiichen opened this issue 1 year ago • 2 comments

System Info

optimum version: 1.20.0
system: OSX X64
dependencies: sentence_transformers==2.2.2

Who can help?

@michaelbenayoun The location that throws this error is tasks.py#L209. I think this error is made by imcompatibility of the target model class. Just simply removing the argument works for me.

@xenova Noticed that this is introduced by your PR here #1677 , any ideas for this?

Information

  • [ ] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [X] 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 --model moka-ai/m3e-small --task sentence-similarity --framework pt --library-name sentence_transformers onnx/

Expected behavior

Using the export variant default. Available variants are: - default: The default ONNX variant.

***** Exporting submodel 1/1: SentenceTransformer ***** Using framework PyTorch: 2.1.0 Overriding 1 configuration item(s) - use_cache -> False Post-processing the exported models... Weight deduplication check in the ONNX export requires accelerate. Please install accelerate to run it.

Validating ONNX model onnx/model.onnx... -[✓] ONNX model output names match reference model (token_embeddings, sentence_embedding) - Validating ONNX Model output "token_embeddings": -[✓] (2, 16, 512) matches (2, 16, 512) -[✓] all values close (atol: 1e-05) - Validating ONNX Model output "sentence_embedding": -[✓] (2, 512) matches (2, 512) -[✓] all values close (atol: 1e-05) The ONNX export succeeded and the exported model was saved at: onnx

chiichen avatar Jul 26 '24 08:07 chiichen

Hi there! 👋 Are you able to upgrade your version of sentence transformers? The latest version is v3.0.1, and the latest v2 version is v2.7.0.

xenova avatar Jul 26 '24 15:07 xenova

Hi there! 👋 Are you able to upgrade your version of sentence transformers? The latest version is v3.0.1, and the latest v2 version is v2.7.0.

Thanks for your reply! I have some troubles with sentence_transformers. And I have downgraded it to 2.2.2 following the advice here https://github.com/UKPLab/sentence-transformers/issues/1319. I'm not sure about the specific version range of sentence_transformers that works for me. By the way, I'm just wondering if there is some correspondence between the version of optimum and the version of sentence_transformers, a compatibility table will help a lot!

chiichen avatar Jul 26 '24 15:07 chiichen