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

Add Phi-3 small on CPU in model builder #710

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Conversation

kunal-vaishnavi
Copy link
Contributor

Description

This PR adds support for building Phi-3 small ONNX models for CPU in the model builder.

Motivation and Context

Previously, the SparseAttention operator was only supported on CUDA in ONNX Runtime. With the recent support for SparseAttention on CPU, Phi-3 small ONNX models can now run on CPU. This PR also helps this issue.

To use these changes, both ONNX Runtime and ONNX Runtime GenAI need to be built from source. Because the official PyTorch repo does not have a tokenizer.json file, the tokenizer.json file needed for Phi-3 small in ONNX Runtime GenAI can be downloaded from the Hugging Face repos. Please see here for Phi-3 small 8K and here for Phi-3 small 128K.

@yufenglee
Copy link
Member

Description

This PR adds support for building Phi-3 small ONNX models for CPU in the model builder.

Motivation and Context

Previously, the SparseAttention operator was only supported on CUDA in ONNX Runtime. With the recent support for SparseAttention on CPU, Phi-3 small ONNX models can now run on CPU. This PR also helps this issue.

To use these changes, both ONNX Runtime and ONNX Runtime GenAI need to be built from source. Because the official PyTorch repo does not have a tokenizer.json file, the tokenizer.json file needed for Phi-3 small in ONNX Runtime GenAI can be downloaded from the Hugging Face repos. Please see here for Phi-3 small 8K and here for Phi-3 small 128K.

How does the PyTorch tokenizer work without tokenizer.json?

@kunal-vaishnavi
Copy link
Contributor Author

How does the PyTorch tokenizer work without tokenizer.json?

There's a custom Python tokenizer file that is used.

@kunal-vaishnavi kunal-vaishnavi merged commit 3ea820d into main Jul 29, 2024
13 checks passed
@kunal-vaishnavi kunal-vaishnavi deleted the kvaishnavi/phi3-small branch July 29, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants