kvaishnavi commited on
Commit
6c0e1f0
·
verified ·
1 Parent(s): f826195

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +80 -3
README.md CHANGED
@@ -1,3 +1,80 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - ONNX
5
+ - ONNX Runtime
6
+ - code
7
+ - nlp
8
+ - phi4
9
+
10
+ language:
11
+ - en
12
+ ---
13
+ # Phi-4 Reasoning ONNX models
14
+
15
+ ## Introduction
16
+ This repository hosts the optimized versions of the Phi-4 reasoning models to accelerate inference with ONNX Runtime.
17
+
18
+ Optimized models are published here in ONNX format to run with ONNX Runtime on CPU and GPU across devices, including server platforms, Windows, Linux and Mac desktops, and mobile CPUs, with the precision best suited to each of these targets.
19
+
20
+ Here are some of the optimized configurations we have added:
21
+
22
+ 1. ONNX model for int4 CPU: ONNX model for CPU and mobile using int4 quantization via RTN.
23
+ 2. ONNX model for int4 GPU: ONNX model for GPU using int4 quantization via RTN.
24
+
25
+ ## Model Run
26
+ You can see how to run examples with ORT GenAI [here](https://github.com/microsoft/onnxruntime-genai/blob/main/examples/python/phi-3-tutorial.md)
27
+
28
+ For CPU:
29
+
30
+ ```bash
31
+ # Download the model directly using the Hugging Face CLI
32
+ huggingface-cli download microsoft/Phi-4-reasoning-onnx --include cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4/* --local-dir .
33
+
34
+ # Install the CPU package of ONNX Runtime GenAI
35
+ pip install --pre onnxruntime-genai
36
+
37
+ # Please adjust the model directory (-m) accordingly
38
+ curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/phi3-qa.py -o phi3-qa.py
39
+ python phi3-qa.py -m cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4 -e cpu
40
+ ```
41
+
42
+ For CUDA:
43
+
44
+ ```bash
45
+ # Download the model directly using the Hugging Face CLI
46
+ huggingface-cli download microsoft/Phi-4-reasoning-onnx --include gpu/* --local-dir .
47
+
48
+ # Install the CUDA package of ONNX Runtime GenAI
49
+ pip install --pre onnxruntime-genai-cuda
50
+
51
+ # Please adjust the model directory (-m) accordingly
52
+ curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/phi3-qa.py -o phi3-qa.py
53
+ python phi3-qa.py -m gpu/gpu-int4-rtn-block-32 -e cuda
54
+ ```
55
+
56
+ For DirectML:
57
+
58
+ ```bash
59
+ # Download the model directly using the Hugging Face CLI
60
+ huggingface-cli download microsoft/Phi-4-reasoning-onnx --include gpu/* --local-dir .
61
+
62
+ # Install the DML package of ONNX Runtime GenAI
63
+ onnxruntime-genai-directml
64
+
65
+ # Please adjust the model directory (-m) accordingly
66
+ curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/phi3-qa.py -o phi3-qa.py
67
+ python phi3-qa.py -m gpu/gpu-int4-rtn-block-32 -e dml
68
+ ```
69
+
70
+ ## Model Description
71
+ - Developed by: Microsoft
72
+ - Model type: ONNX
73
+ - License: MIT
74
+ - Model Description: This is a conversion of the Phi-4 reasoning model for ONNX Runtime inference.
75
+
76
+ **Disclaimer:** Model is only an optimization of the base model, any risk associated with the model is the responsibility of the user of the model. Please verify and test for your scenarios. There may be a slight difference in output from the base model with the optimizations applied.
77
+
78
+ ## Base Model
79
+ Phi-4 reasoning is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.
80
+ See details at [https://huggingface.co/microsoft/Phi-4-reasoning/blob/main/README.md](https://huggingface.co/microsoft/Phi-4-reasoning/blob/main/README.md).