shreyajn commited on
Commit
c1b684e
·
verified ·
1 Parent(s): 8656a6b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +29 -32
README.md CHANGED
@@ -38,8 +38,8 @@ More details on model performance across various devices, can be found
38
 
39
  | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
40
  | ---|---|---|---|---|---|---|---|
41
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 16.917 ms | 2 - 5 MB | FP16 | NPU | [FFNet-40S.tflite](https://huggingface.co/qualcomm/FFNet-40S/blob/main/FFNet-40S.tflite)
42
- | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 17.383 ms | 26 - 40 MB | FP16 | NPU | [FFNet-40S.so](https://huggingface.co/qualcomm/FFNet-40S/blob/main/FFNet-40S.so)
43
 
44
 
45
 
@@ -101,9 +101,9 @@ python -m qai_hub_models.models.ffnet_40s.export
101
  ```
102
  Profile Job summary of FFNet-40S
103
  --------------------------------------------------
104
- Device: SA8255 (Proxy) (13)
105
- Estimated Inference Time: 17.20 ms
106
- Estimated Peak Memory Range: 24.04-37.86 MB
107
  Compute Units: NPU (140) | Total (140)
108
 
109
 
@@ -125,29 +125,13 @@ in memory using the `jit.trace` and then call the `submit_compile_job` API.
125
  import torch
126
 
127
  import qai_hub as hub
128
- from qai_hub_models.models.ffnet_40s import Model
129
 
130
  # Load the model
131
- torch_model = Model.from_pretrained()
132
 
133
  # Device
134
  device = hub.Device("Samsung Galaxy S23")
135
 
136
- # Trace model
137
- input_shape = torch_model.get_input_spec()
138
- sample_inputs = torch_model.sample_inputs()
139
-
140
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
141
-
142
- # Compile model on a specific device
143
- compile_job = hub.submit_compile_job(
144
- model=pt_model,
145
- device=device,
146
- input_specs=torch_model.get_input_spec(),
147
- )
148
-
149
- # Get target model to run on-device
150
- target_model = compile_job.get_target_model()
151
 
152
  ```
153
 
@@ -160,10 +144,10 @@ provisioned in the cloud. Once the job is submitted, you can navigate to a
160
  provided job URL to view a variety of on-device performance metrics.
161
  ```python
162
  profile_job = hub.submit_profile_job(
163
- model=target_model,
164
- device=device,
165
- )
166
-
167
  ```
168
 
169
  Step 3: **Verify on-device accuracy**
@@ -173,12 +157,11 @@ on sample input data on the same cloud hosted device.
173
  ```python
174
  input_data = torch_model.sample_inputs()
175
  inference_job = hub.submit_inference_job(
176
- model=target_model,
177
- device=device,
178
- inputs=input_data,
179
- )
180
-
181
- on_device_output = inference_job.download_output_data()
182
 
183
  ```
184
  With the output of the model, you can compute like PSNR, relative errors or
@@ -189,6 +172,20 @@ AI Hub. [Sign up for access](https://myaccount.qualcomm.com/signup).
189
 
190
 
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
  ## Deploying compiled model to Android
194
 
 
38
 
39
  | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Precision | Primary Compute Unit | Target Model
40
  | ---|---|---|---|---|---|---|---|
41
+ | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | TFLite | 16.996 ms | 4 - 6 MB | FP16 | NPU | [FFNet-40S.tflite](https://huggingface.co/qualcomm/FFNet-40S/blob/main/FFNet-40S.tflite)
42
+ | Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 17.404 ms | 24 - 49 MB | FP16 | NPU | [FFNet-40S.so](https://huggingface.co/qualcomm/FFNet-40S/blob/main/FFNet-40S.so)
43
 
44
 
45
 
 
101
  ```
102
  Profile Job summary of FFNet-40S
103
  --------------------------------------------------
104
+ Device: Snapdragon X Elite CRD (11)
105
+ Estimated Inference Time: 17.80 ms
106
+ Estimated Peak Memory Range: 24.05-24.05 MB
107
  Compute Units: NPU (140) | Total (140)
108
 
109
 
 
125
  import torch
126
 
127
  import qai_hub as hub
128
+ from qai_hub_models.models.ffnet_40s import
129
 
130
  # Load the model
 
131
 
132
  # Device
133
  device = hub.Device("Samsung Galaxy S23")
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  ```
137
 
 
144
  provided job URL to view a variety of on-device performance metrics.
145
  ```python
146
  profile_job = hub.submit_profile_job(
147
+ model=target_model,
148
+ device=device,
149
+ )
150
+
151
  ```
152
 
153
  Step 3: **Verify on-device accuracy**
 
157
  ```python
158
  input_data = torch_model.sample_inputs()
159
  inference_job = hub.submit_inference_job(
160
+ model=target_model,
161
+ device=device,
162
+ inputs=input_data,
163
+ )
164
+ on_device_output = inference_job.download_output_data()
 
165
 
166
  ```
167
  With the output of the model, you can compute like PSNR, relative errors or
 
172
 
173
 
174
 
175
+ ## Run demo on a cloud-hosted device
176
+
177
+ You can also run the demo on-device.
178
+
179
+ ```bash
180
+ python -m qai_hub_models.models.ffnet_40s.demo --on-device
181
+ ```
182
+
183
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
184
+ environment, please add the following to your cell (instead of the above).
185
+ ```
186
+ %run -m qai_hub_models.models.ffnet_40s.demo -- --on-device
187
+ ```
188
+
189
 
190
  ## Deploying compiled model to Android
191