shreyajn commited on
Commit
3cc962d
·
verified ·
1 Parent(s): d005660

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +11 -28
README.md CHANGED
@@ -38,7 +38,7 @@ 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 | 81.874 ms | 0 - 4 MB | FP16 | NPU | [VIT.tflite](https://huggingface.co/qualcomm/VIT/blob/main/VIT.tflite)
42
 
43
 
44
 
@@ -113,29 +113,13 @@ in memory using the `jit.trace` and then call the `submit_compile_job` API.
113
  import torch
114
 
115
  import qai_hub as hub
116
- from qai_hub_models.models.vit import Model
117
 
118
  # Load the model
119
- torch_model = Model.from_pretrained()
120
 
121
  # Device
122
  device = hub.Device("Samsung Galaxy S23")
123
 
124
- # Trace model
125
- input_shape = torch_model.get_input_spec()
126
- sample_inputs = torch_model.sample_inputs()
127
-
128
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
129
-
130
- # Compile model on a specific device
131
- compile_job = hub.submit_compile_job(
132
- model=pt_model,
133
- device=device,
134
- input_specs=torch_model.get_input_spec(),
135
- )
136
-
137
- # Get target model to run on-device
138
- target_model = compile_job.get_target_model()
139
 
140
  ```
141
 
@@ -148,10 +132,10 @@ provisioned in the cloud. Once the job is submitted, you can navigate to a
148
  provided job URL to view a variety of on-device performance metrics.
149
  ```python
150
  profile_job = hub.submit_profile_job(
151
- model=target_model,
152
- device=device,
153
- )
154
-
155
  ```
156
 
157
  Step 3: **Verify on-device accuracy**
@@ -161,12 +145,11 @@ on sample input data on the same cloud hosted device.
161
  ```python
162
  input_data = torch_model.sample_inputs()
163
  inference_job = hub.submit_inference_job(
164
- model=target_model,
165
- device=device,
166
- inputs=input_data,
167
- )
168
-
169
- on_device_output = inference_job.download_output_data()
170
 
171
  ```
172
  With the output of the model, you can compute like PSNR, relative errors or
 
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 | 139.311 ms | 4 - 7 MB | FP16 | NPU | [VIT.tflite](https://huggingface.co/qualcomm/VIT/blob/main/VIT.tflite)
42
 
43
 
44
 
 
113
  import torch
114
 
115
  import qai_hub as hub
116
+ from qai_hub_models.models.vit import
117
 
118
  # Load the model
 
119
 
120
  # Device
121
  device = hub.Device("Samsung Galaxy S23")
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  ```
125
 
 
132
  provided job URL to view a variety of on-device performance metrics.
133
  ```python
134
  profile_job = hub.submit_profile_job(
135
+ model=target_model,
136
+ device=device,
137
+ )
138
+
139
  ```
140
 
141
  Step 3: **Verify on-device accuracy**
 
145
  ```python
146
  input_data = torch_model.sample_inputs()
147
  inference_job = hub.submit_inference_job(
148
+ model=target_model,
149
+ device=device,
150
+ inputs=input_data,
151
+ )
152
+ on_device_output = inference_job.download_output_data()
 
153
 
154
  ```
155
  With the output of the model, you can compute like PSNR, relative errors or