Phi-3 Small-8K-Istruct ONNX CUDA models
This repository hosts the optimized versios of Phi-3-small-8k-istruct to accelerate iferece with ONNX Rutime for your machies with NVIDIA GPUs.
Phi-3 Small is a 7B parameter, lightweight, state-of-the-art ope model traied with the Phi-3 datasets, which iclude both sythetic data ad filtered publicly available website data, with a focus o high-quality ad reasoig-dese properties. The model belogs to the Phi-3 family with the small versio i two variats: 8K ad 128K, which are the cotext legths (i tokes) that they ca support.
The base model has udergoe a post-traiig process that icorporates both supervised fie-tuig ad direct preferece optimizatio for the istructio followig ad safety measures. Whe assessed agaist bechmarks testig commo sese, laguage uderstadig, math, code, log cotext, ad logical reasoig, Phi-3-Small-8K-Istruct showcased a robust ad state-of-the-art performace amog models of the same-size ad ext-size-up.
Optimized variats of the Phi-3 Small models are published here i ONNX format ad ru with ONNX Rutime o GPU across devices, icludig server platforms, Widows, ad Liux.
ONNX Models
Here are some of the optimized cofiguratios we have added:
- ONNX model for FP16 CUDA: ONNX model for NVIDIA GPUs.
- ONNX model for INT4 CUDA: ONNX model for NVIDIA GPUs usig it4 quatizatio via RTN.
Note: Usig the Huggig Face CLI, you ca dowload sub folders ad ot all models if you are limited o disk space. The FP16 model is recommeded for larger batch sizes, while the INT4 model optimizes performace for lower batch sizes.
Example:
# Dowload just the FP16 model
$ huggigface-cli dowload microsoft/Phi-3-small-8k-istruct-ox-cuda --iclude cuda-fp16/* --local-dir . --local-dir-use-symliks False
How to Get Started with the Model
To support the Phi-3 models across a rage of devices, platforms, ad EP backeds, we itroduce a ew API to wrap several aspects of geerative AI iferecig. This API makes it easy to drag ad drop LLMs straight ito your app. To ru the early versio of these models with ONNX, follow the steps here. You ca also test the models with this chat app.
Hardware Supported
The ONNX models are tested o:
- 1 A100 GPU, SKU: StadardND96amsrA100_v4 (CUDA)
Miimum Cofiguratio Required:
Model Descriptio
- Developed by: Microsoft
- Model type: ONNX
- Laguage(s) (NLP): Pytho, C, C++
- Licese: MIT
- Model Descriptio: This is a coversio of the Phi-3 Small-8K-Istruct model for ONNX Rutime iferece.
Additioal Details
Performace Metrics
Phi-3 Small-8K-Istruct performs better with ONNX Rutime compared to PyTorch for all batch size, prompt legth combiatios. For FP16 CUDA, ORT performs up to 4X faster tha PyTorch, while with INT4 CUDA, it's up to 10.9X faster tha PyTorch.
The table below shows the average throughput of the first 256 tokes geerated (tps) for FP16 ad INT4 precisios o CUDA as measured o 1 A100 80GB GPU, SKU: StadardND96amsrA100_v4.
| Batch Size, Prompt Legth |
ORT FP16 CUDA |
PyTorch Eager FP16 CUDA |
Speed Up ORT/PyTorch |
| 1, 16 |
74.62 |
16.81 |
4.44 |
| 4, 16 |
290.36 |
65.56 |
4.43 |
| 16,16 |
1036.93 |
267.33 |
3.88 |
| Batch Size, Prompt Legth |
ORT INT4 CUDA |
PyTorch Eager INT4 CUDA |
Speed Up ORT/PyTorch |
| 1, 16 |
140.68 |
12.93 |
10.88 |
| 4, 16 |
152.90 |
44.04 |
3.47 |
| 16,16 |
582.07 |
160.57 |
3.62 |
Package Versios
| Pip package ame |
Versio |
| torch |
2.3.0 |
| trito |
2.3.0 |
| oxrutime-gpu |
1.18.0 |
| trasformers |
4.40.2 |
| bitsadbytes |
0.43.1 |
Appedix
Model Card Cotact
pariitarahi, kvaishavi, atke
Cotributors
Kual Vaishavi, Sughoo Choi, Yufeg Li, Tialei Wu, Sheetal Aru Kadam, Rui Re, Baiju Meswai, Natalie Kershaw, Pariita Rahi
评论