-
Notifications
You must be signed in to change notification settings - Fork 154
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
Help needed to export Phi3v in ONNX #685
Comments
The Phi-3 vision ONNX models are created as follows.
I can open-source the scripts used to create these ONNX models and run them with ONNX Runtime GenAI. |
@kunal-vaishnavi If you open-source it, I would really appreciate it! |
@kunal-vaishnavi open-source scripts would be really helpful to the Phi community. |
I have uploaded the necessary files in each of the Hugging Face repos and created this PR to show how to use them. |
### Description This PR open-sources the scripts used to generate the Phi-3 vision ONNX models that run with ONNX Runtime GenAI. The extra files needed for generating the Phi-3 vision ONNX models have been uploaded to the Hugging Face repos. - [`microsoft/Phi-3-vision-128k-instruct-onnx-cpu`](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cpu/tree/main/onnx) - [`microsoft/Phi-3-vision-128k-instruct-onnx-cuda`](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cuda/tree/main/onnx) - [`microsoft/Phi-3-vision-128k-instruct-onnx-directml`](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-directml/tree/main/onnx) ### Motivation and Context This PR allows users to build the ONNX models needed for Phi-3 vision. It also helps the following issues. - #571 - #685
### Description This PR open-sources the scripts used to generate the Phi-3 vision ONNX models that run with ONNX Runtime GenAI. The extra files needed for generating the Phi-3 vision ONNX models have been uploaded to the Hugging Face repos. - [`microsoft/Phi-3-vision-128k-instruct-onnx-cpu`](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cpu/tree/main/onnx) - [`microsoft/Phi-3-vision-128k-instruct-onnx-cuda`](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cuda/tree/main/onnx) - [`microsoft/Phi-3-vision-128k-instruct-onnx-directml`](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-directml/tree/main/onnx) ### Motivation and Context This PR allows users to build the ONNX models needed for Phi-3 vision. It also helps the following issues. - #571 - #685
Quick question, would the same guide work for Phi3.5 vision model family ? |
Yes, but the Please note that this guide only works for a single image, however. We have re-designed the ONNX models so that there is multi-image support for both Phi-3 vision and Phi-3.5 vision. As mentioned here, the new ONNX models are undergoing Microsoft's Responsible AI evaluations before they can be published officially. The changes needed within ONNX Runtime GenAI for the new ONNX models have already been merged in this PR. A revised guide as well as a new ONNX Runtime GenAI stable release will be published together to support this work. |
Hi there,
I'm seeking guidance on exporting a custom fine-tuned Phi-3 Vision model to ONNX. I've followed the ONNX build model guide from this link.
The build command I used was:
python3 -m onnxruntime_genai.models.builder -i ep_2_grad_32_lr_3e-5/ -o onnx_output/ -p int4 -e cuda --extra_options int4_block_size=32 int4_accuracy_level=4
The build process was successful and generated the following files:
However, the number of files generated doesn't match the file count in the official HF repo for ONNX
microsoft/Phi-3-vision-128k-instruct-onnx-cuda
Files highlighted in red below are missing:

Additionally, while loading the model using ONNX Runtime, the following error occurs:
OrtException: Load model from onnx_output failed: Protobuf parsing failed.
I have also noticed that sections for "embedding" and "vision" are missing from the
genai_config.json
Can someone help me identify if I'm missing anything? Thanks
The text was updated successfully, but these errors were encountered: