shreyajn commited on
Commit
3bdbf30
·
verified ·
1 Parent(s): c0e9ce6

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +28 -31
README.md CHANGED
@@ -34,7 +34,7 @@ More details on model performance across various devices, can be found
34
 
35
  | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
36
  | ---|---|---|---|---|---|---|---|
37
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 2.502 ms | 0 - 1 MB | FP16 | NPU | [XLSR.tflite](https://huggingface.co/qualcomm/XLSR/blob/main/XLSR.tflite)
38
  | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 1.363 ms | 0 - 5 MB | FP16 | NPU | [XLSR.so](https://huggingface.co/qualcomm/XLSR/blob/main/XLSR.so)
39
 
40
 
@@ -96,9 +96,9 @@ python -m qai_hub_models.models.xlsr.export
96
  ```
97
  Profile Job summary of XLSR
98
  --------------------------------------------------
99
- Device: SA8255 (Proxy) (13)
100
- Estimated Inference Time: 1.35 ms
101
- Estimated Peak Memory Range: 0.22-5.20 MB
102
  Compute Units: NPU (21) | Total (21)
103
 
104
 
@@ -120,29 +120,13 @@ in memory using the `jit.trace` and then call the `submit_compile_job` API.
120
  import torch
121
 
122
  import qai_hub as hub
123
- from qai_hub_models.models.xlsr import Model
124
 
125
  # Load the model
126
- torch_model = Model.from_pretrained()
127
 
128
  # Device
129
  device = hub.Device("Samsung Galaxy S23")
130
 
131
- # Trace model
132
- input_shape = torch_model.get_input_spec()
133
- sample_inputs = torch_model.sample_inputs()
134
-
135
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
136
-
137
- # Compile model on a specific device
138
- compile_job = hub.submit_compile_job(
139
- model=pt_model,
140
- device=device,
141
- input_specs=torch_model.get_input_spec(),
142
- )
143
-
144
- # Get target model to run on-device
145
- target_model = compile_job.get_target_model()
146
 
147
  ```
148
 
@@ -155,10 +139,10 @@ provisioned in the cloud. Once the job is submitted, you can navigate to a
155
  provided job URL to view a variety of on-device performance metrics.
156
  ```python
157
  profile_job = hub.submit_profile_job(
158
- model=target_model,
159
- device=device,
160
- )
161
-
162
  ```
163
 
164
  Step 3: **Verify on-device accuracy**
@@ -168,12 +152,11 @@ on sample input data on the same cloud hosted device.
168
  ```python
169
  input_data = torch_model.sample_inputs()
170
  inference_job = hub.submit_inference_job(
171
- model=target_model,
172
- device=device,
173
- inputs=input_data,
174
- )
175
-
176
- on_device_output = inference_job.download_output_data()
177
 
178
  ```
179
  With the output of the model, you can compute like PSNR, relative errors or
@@ -184,6 +167,20 @@ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
184
 
185
 
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
  ## Deploying compiled model to Android
189
 
 
34
 
35
  | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
36
  | ---|---|---|---|---|---|---|---|
37
+ | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 2.51 ms | 0 - 17 MB | FP16 | NPU | [XLSR.tflite](https://huggingface.co/qualcomm/XLSR/blob/main/XLSR.tflite)
38
  | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 1.363 ms | 0 - 5 MB | FP16 | NPU | [XLSR.so](https://huggingface.co/qualcomm/XLSR/blob/main/XLSR.so)
39
 
40
 
 
96
  ```
97
  Profile Job summary of XLSR
98
  --------------------------------------------------
99
+ Device: Snapdragon X Elite CRD (11)
100
+ Estimated Inference Time: 1.49 ms
101
+ Estimated Peak Memory Range: 0.20-0.20 MB
102
  Compute Units: NPU (21) | Total (21)
103
 
104
 
 
120
  import torch
121
 
122
  import qai_hub as hub
123
+ from qai_hub_models.models.xlsr import
124
 
125
  # Load the model
 
126
 
127
  # Device
128
  device = hub.Device("Samsung Galaxy S23")
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  ```
132
 
 
139
  provided job URL to view a variety of on-device performance metrics.
140
  ```python
141
  profile_job = hub.submit_profile_job(
142
+ model=target_model,
143
+ device=device,
144
+ )
145
+
146
  ```
147
 
148
  Step 3: **Verify on-device accuracy**
 
152
  ```python
153
  input_data = torch_model.sample_inputs()
154
  inference_job = hub.submit_inference_job(
155
+ model=target_model,
156
+ device=device,
157
+ inputs=input_data,
158
+ )
159
+ on_device_output = inference_job.download_output_data()
 
160
 
161
  ```
162
  With the output of the model, you can compute like PSNR, relative errors or
 
167
 
168
 
169
 
170
+ ## Run demo on a cloud-hosted device
171
+
172
+ You can also run the demo on-device.
173
+
174
+ ```bash
175
+ python -m qai_hub_models.models.xlsr.demo --on-device
176
+ ```
177
+
178
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
179
+ environment, please add the following to your cell (instead of the above).
180
+ ```
181
+ %run -m qai_hub_models.models.xlsr.demo -- --on-device
182
+ ```
183
+
184
 
185
  ## Deploying compiled model to Android
186