share code convert model
#1
by
williamljx
- opened
Hi, could you share code for converting the Medgemma-4b-pt model (.safetensors) to ONNX?
I convert the models to onnx using onnxruntime-genai
pip install onnxruntime-genai --pre
pip install onnx onnx-ir safetensors torch transformers gguf
then run the following command
from onnxruntime_genai.models.builder import create _model
create_model("hf id name"
,"None /model dir/gguf)
,"output dir ",
," precision int4 f16 "
," cpu /cuda/webgpu",
,"cache_dir",
**extra)
I convert the models to onnx using onnxruntime-genai
pip install onnxruntime-genai --pre pip install onnx onnx-ir safetensors torch transformers gguf
then run the following command
from onnxruntime_genai.models.builder import create _model create_model("hf id name" ,"None /model dir/gguf) ,"output dir ", ," precision int4 f16 " ," cpu /cuda/webgpu", ,"cache_dir", **extra)
Just change the inputs
Not all model types are supported
Vision onnx model is still in development