Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -125,11 +125,9 @@ This [export script](https://aihub.qualcomm.com/models/whisper_tiny_en/qai_hub_m
|
|
125 |
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
126 |
on-device. Lets go through each step below in detail:
|
127 |
|
128 |
-
Step 1: **
|
129 |
-
|
130 |
-
To compile a PyTorch model for on-device deployment, we first trace the model
|
131 |
-
in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
132 |
|
|
|
133 |
```python
|
134 |
import torch
|
135 |
|
@@ -137,27 +135,10 @@ import qai_hub as hub
|
|
137 |
from qai_hub_models.models.whisper_tiny_en import Model
|
138 |
|
139 |
# Load the model
|
140 |
-
|
141 |
-
|
142 |
-
# Device
|
143 |
-
device = hub.Device("Samsung Galaxy S23")
|
144 |
-
|
145 |
-
# Trace model
|
146 |
-
input_shape = torch_model.get_input_spec()
|
147 |
-
sample_inputs = torch_model.sample_inputs()
|
148 |
-
|
149 |
-
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
150 |
-
|
151 |
-
# Compile model on a specific device
|
152 |
-
compile_job = hub.submit_compile_job(
|
153 |
-
model=pt_model,
|
154 |
-
device=device,
|
155 |
-
input_specs=torch_model.get_input_spec(),
|
156 |
-
)
|
157 |
-
|
158 |
-
# Get target model to run on-device
|
159 |
-
target_model = compile_job.get_target_model()
|
160 |
|
|
|
|
|
161 |
```
|
162 |
|
163 |
|
|
|
125 |
leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
|
126 |
on-device. Lets go through each step below in detail:
|
127 |
|
128 |
+
Step 1: **Upload compiled model**
|
|
|
|
|
|
|
129 |
|
130 |
+
Upload compiled models from `qai_hub_models.models.whisper_tiny_en` on hub.
|
131 |
```python
|
132 |
import torch
|
133 |
|
|
|
135 |
from qai_hub_models.models.whisper_tiny_en import Model
|
136 |
|
137 |
# Load the model
|
138 |
+
model = Model.from_precompiled()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
model_WhisperEncoder = hub.upload_model(model.encoder.get_target_model_path())
|
141 |
+
model_WhisperDecoder = hub.upload_model(model.decoder.get_target_model_path())
|
142 |
```
|
143 |
|
144 |
|