optimum icon indicating copy to clipboard operation
optimum copied to clipboard

not able to convert DeepSeek-R1 into Onnx using optimum-cli

Open volcano619 opened this issue 1 year ago • 1 comments

System Info

v1.24.0

Who can help?

@michaelbenayoun

I'm trying to convert DeepSeek-R1 into a onnx format, but i'm being presented with

ValueError: Loading deepseek-ai/DeepSeek-R1 requires you to execute the configuration file in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option trust_remote_code=True to remove this error.

I'm trying to do this using optimum-cli

optimum-cli export onnx --model deepseek-ai/DeepSeek-R1 --task causal-lm C:\DeepSeek-R1-Onnx

Can i somehow enable this using cli, or do i have to manually download the model into my system and using cli i would have to perform onnx instead of repo link

if yes, then how can i enable trust_remote_code=True once i download the repo?

Information

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

Tasks

  • [ ] 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)

optimum-cli export onnx --model deepseek-ai/DeepSeek-R1 --task causal-lm C:\DeepSeek-R1-Onnx

Running this command doesn't provide an output

Expected behavior

The conversion should start for DeepSeek-R1 to ONNX

volcano619 avatar Mar 13 '25 07:03 volcano619

You can pass trust_remote_code=True to optimum-cli with the flag --trust-remote-code

So you could run:

optimum-cli export onnx --model deepseek-ai/DeepSeek-R1 --task causal-lm C:\DeepSeek-R1-Onnx --trust-remote-code

EdwardJRoss avatar May 13 '25 11:05 EdwardJRoss