Upload README.md with huggingface_hub
Browse files
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 | 1.
|
| 42 |
-
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 1.
|
| 43 |
|
| 44 |
|
| 45 |
|
|
@@ -100,9 +100,9 @@ python -m qai_hub_models.models.efficientnet_b0.export
|
|
| 100 |
```
|
| 101 |
Profile Job summary of EfficientNet-B0
|
| 102 |
--------------------------------------------------
|
| 103 |
-
Device:
|
| 104 |
-
Estimated Inference Time: 1.
|
| 105 |
-
Estimated Peak Memory Range: 0.
|
| 106 |
Compute Units: NPU (243) | Total (243)
|
| 107 |
|
| 108 |
|
|
@@ -124,29 +124,13 @@ in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
|
| 124 |
import torch
|
| 125 |
|
| 126 |
import qai_hub as hub
|
| 127 |
-
from qai_hub_models.models.efficientnet_b0 import
|
| 128 |
|
| 129 |
# Load the model
|
| 130 |
-
torch_model = Model.from_pretrained()
|
| 131 |
|
| 132 |
# Device
|
| 133 |
device = hub.Device("Samsung Galaxy S23")
|
| 134 |
|
| 135 |
-
# Trace model
|
| 136 |
-
input_shape = torch_model.get_input_spec()
|
| 137 |
-
sample_inputs = torch_model.sample_inputs()
|
| 138 |
-
|
| 139 |
-
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
| 140 |
-
|
| 141 |
-
# Compile model on a specific device
|
| 142 |
-
compile_job = hub.submit_compile_job(
|
| 143 |
-
model=pt_model,
|
| 144 |
-
device=device,
|
| 145 |
-
input_specs=torch_model.get_input_spec(),
|
| 146 |
-
)
|
| 147 |
-
|
| 148 |
-
# Get target model to run on-device
|
| 149 |
-
target_model = compile_job.get_target_model()
|
| 150 |
|
| 151 |
```
|
| 152 |
|
|
@@ -159,10 +143,10 @@ provisioned in the cloud. Once the job is submitted, you can navigate to a
|
|
| 159 |
provided job URL to view a variety of on-device performance metrics.
|
| 160 |
```python
|
| 161 |
profile_job = hub.submit_profile_job(
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
)
|
| 165 |
-
|
| 166 |
```
|
| 167 |
|
| 168 |
Step 3: **Verify on-device accuracy**
|
|
@@ -172,12 +156,11 @@ on sample input data on the same cloud hosted device.
|
|
| 172 |
```python
|
| 173 |
input_data = torch_model.sample_inputs()
|
| 174 |
inference_job = hub.submit_inference_job(
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
)
|
| 179 |
-
|
| 180 |
-
on_device_output = inference_job.download_output_data()
|
| 181 |
|
| 182 |
```
|
| 183 |
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 | 1.641 ms | 0 - 1 MB | FP16 | NPU | [EfficientNet-B0.tflite](https://huggingface.co/qualcomm/EfficientNet-B0/blob/main/EfficientNet-B0.tflite)
|
| 42 |
+
| Samsung Galaxy S23 Ultra (Android 13) | Snapdragon® 8 Gen 2 | QNN Model Library | 1.69 ms | 0 - 73 MB | FP16 | NPU | [EfficientNet-B0.so](https://huggingface.co/qualcomm/EfficientNet-B0/blob/main/EfficientNet-B0.so)
|
| 43 |
|
| 44 |
|
| 45 |
|
|
|
|
| 100 |
```
|
| 101 |
Profile Job summary of EfficientNet-B0
|
| 102 |
--------------------------------------------------
|
| 103 |
+
Device: Snapdragon X Elite CRD (11)
|
| 104 |
+
Estimated Inference Time: 1.75 ms
|
| 105 |
+
Estimated Peak Memory Range: 0.57-0.57 MB
|
| 106 |
Compute Units: NPU (243) | Total (243)
|
| 107 |
|
| 108 |
|
|
|
|
| 124 |
import torch
|
| 125 |
|
| 126 |
import qai_hub as hub
|
| 127 |
+
from qai_hub_models.models.efficientnet_b0 import
|
| 128 |
|
| 129 |
# Load the model
|
|
|
|
| 130 |
|
| 131 |
# Device
|
| 132 |
device = hub.Device("Samsung Galaxy S23")
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
```
|
| 136 |
|
|
|
|
| 143 |
provided job URL to view a variety of on-device performance metrics.
|
| 144 |
```python
|
| 145 |
profile_job = hub.submit_profile_job(
|
| 146 |
+
model=target_model,
|
| 147 |
+
device=device,
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
```
|
| 151 |
|
| 152 |
Step 3: **Verify on-device accuracy**
|
|
|
|
| 156 |
```python
|
| 157 |
input_data = torch_model.sample_inputs()
|
| 158 |
inference_job = hub.submit_inference_job(
|
| 159 |
+
model=target_model,
|
| 160 |
+
device=device,
|
| 161 |
+
inputs=input_data,
|
| 162 |
+
)
|
| 163 |
+
on_device_output = inference_job.download_output_data()
|
|
|
|
| 164 |
|
| 165 |
```
|
| 166 |
With the output of the model, you can compute like PSNR, relative errors or
|