v0.45.0
Browse filesSee https://github.com/quic/ai-hub-models/releases/v0.45.0 for changelog.
- .gitattributes +2 -0
- LICENSE +1 -0
- OpusMT-Zh-En_OpusMTDecoder_float.dlc +3 -0
- OpusMT-Zh-En_OpusMTDecoder_float.onnx.zip +3 -0
- OpusMT-Zh-En_OpusMTDecoder_float.tflite +3 -0
- OpusMT-Zh-En_OpusMTEncoder_float.dlc +3 -0
- OpusMT-Zh-En_OpusMTEncoder_float.onnx.zip +3 -0
- OpusMT-Zh-En_OpusMTEncoder_float.tflite +3 -0
- README.md +274 -0
- tool-versions.yaml +4 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
OpusMT-Zh-En_OpusMTDecoder_float.dlc filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
OpusMT-Zh-En_OpusMTEncoder_float.dlc filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
The license of the original trained model can be found at https://github.com/Helsinki-NLP/Opus-MT/blob/master/LICENSE.
|
OpusMT-Zh-En_OpusMTDecoder_float.dlc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e7b955acdd47a903afb7ebf8d99bd6b96eb0418fd74174f88f825b75326a60a8
|
| 3 |
+
size 178309004
|
OpusMT-Zh-En_OpusMTDecoder_float.onnx.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b47789753cbd162d2d999451be2e748049b425a217ca827d1aeec0fe7f29fe16
|
| 3 |
+
size 329246820
|
OpusMT-Zh-En_OpusMTDecoder_float.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c980994705daca5d73d76f6f5980bb169cec92c86e03f506ec412dff5b52c5ff
|
| 3 |
+
size 223058404
|
OpusMT-Zh-En_OpusMTEncoder_float.dlc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:559cd7623f85325e052ead7a6df606a69d85d264cb7d4fe957829dbcdabe15dd
|
| 3 |
+
size 111199780
|
OpusMT-Zh-En_OpusMTEncoder_float.onnx.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7e21472cd1d6da46bd9f208e7f2c22c891f7c5a2160ac01387a56fb38f13b4b5
|
| 3 |
+
size 206471870
|
OpusMT-Zh-En_OpusMTEncoder_float.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04ad9edac9bf944e52148088b1b330772a77be9f504259fbf3ef9ffecb1f82d5
|
| 3 |
+
size 222233484
|
README.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
license: other
|
| 4 |
+
tags:
|
| 5 |
+
- foundation
|
| 6 |
+
- android
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
|
| 13 |
+
# OpusMT-Zh-En: Optimized for Mobile Deployment
|
| 14 |
+
## OpusMT Chinese to English neural machine translation model based on MarianMT transformer architecture
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
OpusMT Chinese to English translation model is a state-of-the-art neural machine translation system designed for translating Chinese text into English. This model is based on the Marian transformer architecture and has been optimized for edge inference by splitting into encoder and decoder components with modified attention mechanisms. It exhibits robust performance for real-world translation tasks, making it highly reliable for practical applications. The model supports input sequences up to 256 tokens and can generate English translations with high accuracy.
|
| 18 |
+
|
| 19 |
+
This model is an implementation of OpusMT-Zh-En found [here](https://github.com/Helsinki-NLP/Opus-MT).
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
This repository provides scripts to run OpusMT-Zh-En on Qualcomm® devices.
|
| 23 |
+
More details on model performance across various devices, can be found
|
| 24 |
+
[here](https://aihub.qualcomm.com/models/opus_mt_zh_en).
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
### Model Details
|
| 29 |
+
|
| 30 |
+
- **Model Type:** Model_use_case.text_generation
|
| 31 |
+
- **Model Stats:**
|
| 32 |
+
- Model checkpoint: Helsinki-NLP/opus-mt-zh-en
|
| 33 |
+
- Input resolution: 256 tokens (Chinese text)
|
| 34 |
+
- Max input sequence length: 256 tokens
|
| 35 |
+
- Max output sequence length: 256 tokens
|
| 36 |
+
- Number of parameters (OpusMTEncoder): ~74M
|
| 37 |
+
- Model size (OpusMTEncoder) (float): ~280 MB
|
| 38 |
+
- Number of parameters (OpusMTDecoder): ~74M
|
| 39 |
+
- Model size (OpusMTDecoder) (float): ~280 MB
|
| 40 |
+
- Number of encoder layers: 6
|
| 41 |
+
- Number of decoder layers: 6
|
| 42 |
+
- Attention heads: 8
|
| 43 |
+
- Hidden dimension: 512
|
| 44 |
+
|
| 45 |
+
| Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
|
| 46 |
+
|---|---|---|---|---|---|---|---|---|
|
| 47 |
+
| OpusMTEncoder | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 12.804 ms | 6 - 181 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 48 |
+
| OpusMTEncoder | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 12.516 ms | 0 - 139 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 49 |
+
| OpusMTEncoder | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 5.108 ms | 6 - 340 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 50 |
+
| OpusMTEncoder | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 4.741 ms | 0 - 171 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 51 |
+
| OpusMTEncoder | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 3.63 ms | 0 - 2 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 52 |
+
| OpusMTEncoder | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 3.526 ms | 0 - 2 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 53 |
+
| OpusMTEncoder | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 5.731 ms | 0 - 114 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 54 |
+
| OpusMTEncoder | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 4.877 ms | 6 - 181 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 55 |
+
| OpusMTEncoder | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 19.322 ms | 0 - 139 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 56 |
+
| OpusMTEncoder | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 12.804 ms | 6 - 181 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 57 |
+
| OpusMTEncoder | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 12.516 ms | 0 - 139 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 58 |
+
| OpusMTEncoder | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 5.525 ms | 6 - 180 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 59 |
+
| OpusMTEncoder | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 5.262 ms | 0 - 139 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 60 |
+
| OpusMTEncoder | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 4.877 ms | 6 - 181 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 61 |
+
| OpusMTEncoder | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 19.322 ms | 0 - 139 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 62 |
+
| OpusMTEncoder | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 2.667 ms | 0 - 341 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 63 |
+
| OpusMTEncoder | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 2.562 ms | 0 - 174 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 64 |
+
| OpusMTEncoder | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 4.141 ms | 15 - 329 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 65 |
+
| OpusMTEncoder | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 2.257 ms | 0 - 355 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 66 |
+
| OpusMTEncoder | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 2.12 ms | 0 - 142 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 67 |
+
| OpusMTEncoder | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 3.556 ms | 0 - 335 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 68 |
+
| OpusMTEncoder | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 1.763 ms | 0 - 314 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 69 |
+
| OpusMTEncoder | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 1.621 ms | 0 - 146 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 70 |
+
| OpusMTEncoder | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 2.843 ms | 0 - 298 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 71 |
+
| OpusMTEncoder | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 3.855 ms | 0 - 0 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 72 |
+
| OpusMTEncoder | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 5.801 ms | 108 - 108 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 73 |
+
| OpusMTDecoder | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 6.408 ms | 0 - 425 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 74 |
+
| OpusMTDecoder | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 5.386 ms | 6 - 242 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 75 |
+
| OpusMTDecoder | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 4.715 ms | 0 - 426 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 76 |
+
| OpusMTDecoder | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 3.999 ms | 2 - 246 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 77 |
+
| OpusMTDecoder | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 3.485 ms | 0 - 4 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 78 |
+
| OpusMTDecoder | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 2.927 ms | 1 - 402 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 79 |
+
| OpusMTDecoder | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 3.846 ms | 12 - 15 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 80 |
+
| OpusMTDecoder | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 4.142 ms | 0 - 292 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 81 |
+
| OpusMTDecoder | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 3.503 ms | 6 - 243 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 82 |
+
| OpusMTDecoder | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 6.408 ms | 0 - 425 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 83 |
+
| OpusMTDecoder | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 5.386 ms | 6 - 242 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 84 |
+
| OpusMTDecoder | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 4.782 ms | 0 - 285 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 85 |
+
| OpusMTDecoder | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 4.095 ms | 6 - 234 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 86 |
+
| OpusMTDecoder | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 4.142 ms | 0 - 292 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 87 |
+
| OpusMTDecoder | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 3.503 ms | 6 - 243 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 88 |
+
| OpusMTDecoder | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 2.622 ms | 0 - 575 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 89 |
+
| OpusMTDecoder | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 2.216 ms | 0 - 259 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 90 |
+
| OpusMTDecoder | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 2.942 ms | 0 - 416 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 91 |
+
| OpusMTDecoder | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 2.334 ms | 0 - 484 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 92 |
+
| OpusMTDecoder | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 1.964 ms | 0 - 234 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 93 |
+
| OpusMTDecoder | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 2.573 ms | 0 - 443 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 94 |
+
| OpusMTDecoder | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 2.156 ms | 0 - 433 MB | NPU | [OpusMT-Zh-En.tflite](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.tflite) |
|
| 95 |
+
| OpusMTDecoder | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 1.884 ms | 0 - 242 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 96 |
+
| OpusMTDecoder | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 2.386 ms | 1 - 406 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 97 |
+
| OpusMTDecoder | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 2.755 ms | 6 - 6 MB | NPU | [OpusMT-Zh-En.dlc](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.dlc) |
|
| 98 |
+
| OpusMTDecoder | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 3.17 ms | 161 - 161 MB | NPU | [OpusMT-Zh-En.onnx.zip](https://huggingface.co/qualcomm/OpusMT-Zh-En/blob/main/OpusMT-Zh-En.onnx.zip) |
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
## Installation
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
Install the package via pip:
|
| 107 |
+
```bash
|
| 108 |
+
# NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
|
| 109 |
+
pip install "qai-hub-models[opus-mt-zh-en]"
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
|
| 114 |
+
|
| 115 |
+
Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
|
| 116 |
+
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
| 117 |
+
|
| 118 |
+
With this API token, you can configure your client to run models on the cloud
|
| 119 |
+
hosted devices.
|
| 120 |
+
```bash
|
| 121 |
+
qai-hub configure --api_token API_TOKEN
|
| 122 |
+
```
|
| 123 |
+
Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
## Demo off target
|
| 128 |
+
|
| 129 |
+
The package contains a simple end-to-end demo that downloads pre-trained
|
| 130 |
+
weights and runs this model on a sample input.
|
| 131 |
+
|
| 132 |
+
```bash
|
| 133 |
+
python -m qai_hub_models.models.opus_mt_zh_en.demo
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
The above demo runs a reference implementation of pre-processing, model
|
| 137 |
+
inference, and post processing.
|
| 138 |
+
|
| 139 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
| 140 |
+
environment, please add the following to your cell (instead of the above).
|
| 141 |
+
```
|
| 142 |
+
%run -m qai_hub_models.models.opus_mt_zh_en.demo
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
### Run model on a cloud-hosted device
|
| 147 |
+
|
| 148 |
+
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
| 149 |
+
device. This script does the following:
|
| 150 |
+
* Performance check on-device on a cloud-hosted device
|
| 151 |
+
* Downloads compiled assets that can be deployed on-device for Android.
|
| 152 |
+
* Accuracy check between PyTorch and on-device outputs.
|
| 153 |
+
|
| 154 |
+
```bash
|
| 155 |
+
python -m qai_hub_models.models.opus_mt_zh_en.export
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
## How does this work?
|
| 161 |
+
|
| 162 |
+
This [export script](https://aihub.qualcomm.com/models/opus_mt_zh_en/qai_hub_models/models/OpusMT-Zh-En/export.py)
|
| 163 |
+
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
| 164 |
+
on-device. Lets go through each step below in detail:
|
| 165 |
+
|
| 166 |
+
Step 1: **Compile model for on-device deployment**
|
| 167 |
+
|
| 168 |
+
To compile a PyTorch model for on-device deployment, we first trace the model
|
| 169 |
+
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
| 170 |
+
|
| 171 |
+
```python
|
| 172 |
+
import torch
|
| 173 |
+
|
| 174 |
+
import qai_hub as hub
|
| 175 |
+
from qai_hub_models.models.opus_mt_zh_en import Model
|
| 176 |
+
|
| 177 |
+
# Load the model
|
| 178 |
+
torch_model = Model.from_pretrained()
|
| 179 |
+
|
| 180 |
+
# Device
|
| 181 |
+
device = hub.Device("Samsung Galaxy S25")
|
| 182 |
+
|
| 183 |
+
# Trace model
|
| 184 |
+
input_shape = torch_model.get_input_spec()
|
| 185 |
+
sample_inputs = torch_model.sample_inputs()
|
| 186 |
+
|
| 187 |
+
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
| 188 |
+
|
| 189 |
+
# Compile model on a specific device
|
| 190 |
+
compile_job = hub.submit_compile_job(
|
| 191 |
+
model=pt_model,
|
| 192 |
+
device=device,
|
| 193 |
+
input_specs=torch_model.get_input_spec(),
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
# Get target model to run on-device
|
| 197 |
+
target_model = compile_job.get_target_model()
|
| 198 |
+
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
Step 2: **Performance profiling on cloud-hosted device**
|
| 203 |
+
|
| 204 |
+
After compiling models from step 1. Models can be profiled model on-device using the
|
| 205 |
+
`target_model`. Note that this scripts runs the model on a device automatically
|
| 206 |
+
provisioned in the cloud. Once the job is submitted, you can navigate to a
|
| 207 |
+
provided job URL to view a variety of on-device performance metrics.
|
| 208 |
+
```python
|
| 209 |
+
profile_job = hub.submit_profile_job(
|
| 210 |
+
model=target_model,
|
| 211 |
+
device=device,
|
| 212 |
+
)
|
| 213 |
+
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
Step 3: **Verify on-device accuracy**
|
| 217 |
+
|
| 218 |
+
To verify the accuracy of the model on-device, you can run on-device inference
|
| 219 |
+
on sample input data on the same cloud hosted device.
|
| 220 |
+
```python
|
| 221 |
+
input_data = torch_model.sample_inputs()
|
| 222 |
+
inference_job = hub.submit_inference_job(
|
| 223 |
+
model=target_model,
|
| 224 |
+
device=device,
|
| 225 |
+
inputs=input_data,
|
| 226 |
+
)
|
| 227 |
+
on_device_output = inference_job.download_output_data()
|
| 228 |
+
|
| 229 |
+
```
|
| 230 |
+
With the output of the model, you can compute like PSNR, relative errors or
|
| 231 |
+
spot check the output with expected output.
|
| 232 |
+
|
| 233 |
+
**Note**: This on-device profiling and inference requires access to Qualcomm®
|
| 234 |
+
AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
## Deploying compiled model to Android
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
The models can be deployed using multiple runtimes:
|
| 243 |
+
- TensorFlow Lite (`.tflite` export): [This
|
| 244 |
+
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
| 245 |
+
guide to deploy the .tflite model in an Android application.
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
- QNN (`.so` export ): This [sample
|
| 249 |
+
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
| 250 |
+
provides instructions on how to use the `.so` shared library in an Android application.
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
## View on Qualcomm® AI Hub
|
| 254 |
+
Get more details on OpusMT-Zh-En's performance across various devices [here](https://aihub.qualcomm.com/models/opus_mt_zh_en).
|
| 255 |
+
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
## License
|
| 259 |
+
* The license for the original implementation of OpusMT-Zh-En can be found
|
| 260 |
+
[here](https://github.com/Helsinki-NLP/Opus-MT/blob/master/LICENSE).
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
## References
|
| 265 |
+
* [OPUS-MT – Building open translation services for the World](https://aclanthology.org/2020.eamt-1.61/)
|
| 266 |
+
* [Source Model Implementation](https://github.com/Helsinki-NLP/Opus-MT)
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
## Community
|
| 271 |
+
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
|
| 272 |
+
* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
|
| 273 |
+
|
| 274 |
+
|
tool-versions.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tool_versions:
|
| 2 |
+
onnx:
|
| 3 |
+
qairt: 2.37.1.250807093845_124904
|
| 4 |
+
onnx_runtime: 1.23.0
|