Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -112,29 +112,13 @@ in memory using the `jit.trace` and then call the `submit_compile_job` API.
|
|
112 |
import torch
|
113 |
|
114 |
import qai_hub as hub
|
115 |
-
from qai_hub_models.models.yolov8_seg import
|
116 |
|
117 |
# Load the model
|
118 |
-
torch_model = Model.from_pretrained()
|
119 |
|
120 |
# Device
|
121 |
device = hub.Device("Samsung Galaxy S23")
|
122 |
|
123 |
-
# Trace model
|
124 |
-
input_shape = torch_model.get_input_spec()
|
125 |
-
sample_inputs = torch_model.sample_inputs()
|
126 |
-
|
127 |
-
pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
|
128 |
-
|
129 |
-
# Compile model on a specific device
|
130 |
-
compile_job = hub.submit_compile_job(
|
131 |
-
model=pt_model,
|
132 |
-
device=device,
|
133 |
-
input_specs=torch_model.get_input_spec(),
|
134 |
-
)
|
135 |
-
|
136 |
-
# Get target model to run on-device
|
137 |
-
target_model = compile_job.get_target_model()
|
138 |
|
139 |
```
|
140 |
|
@@ -147,10 +131,10 @@ provisioned in the cloud. Once the job is submitted, you can navigate to a
|
|
147 |
provided job URL to view a variety of on-device performance metrics.
|
148 |
```python
|
149 |
profile_job = hub.submit_profile_job(
|
150 |
-
|
151 |
-
|
152 |
-
)
|
153 |
-
|
154 |
```
|
155 |
|
156 |
Step 3: **Verify on-device accuracy**
|
@@ -160,12 +144,11 @@ on sample input data on the same cloud hosted device.
|
|
160 |
```python
|
161 |
input_data = torch_model.sample_inputs()
|
162 |
inference_job = hub.submit_inference_job(
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
)
|
167 |
-
|
168 |
-
on_device_output = inference_job.download_output_data()
|
169 |
|
170 |
```
|
171 |
With the output of the model, you can compute like PSNR, relative errors or
|
|
|
112 |
import torch
|
113 |
|
114 |
import qai_hub as hub
|
115 |
+
from qai_hub_models.models.yolov8_seg import
|
116 |
|
117 |
# Load the model
|
|
|
118 |
|
119 |
# Device
|
120 |
device = hub.Device("Samsung Galaxy S23")
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
```
|
124 |
|
|
|
131 |
provided job URL to view a variety of on-device performance metrics.
|
132 |
```python
|
133 |
profile_job = hub.submit_profile_job(
|
134 |
+
model=target_model,
|
135 |
+
device=device,
|
136 |
+
)
|
137 |
+
|
138 |
```
|
139 |
|
140 |
Step 3: **Verify on-device accuracy**
|
|
|
144 |
```python
|
145 |
input_data = torch_model.sample_inputs()
|
146 |
inference_job = hub.submit_inference_job(
|
147 |
+
model=target_model,
|
148 |
+
device=device,
|
149 |
+
inputs=input_data,
|
150 |
+
)
|
151 |
+
on_device_output = inference_job.download_output_data()
|
|
|
152 |
|
153 |
```
|
154 |
With the output of the model, you can compute like PSNR, relative errors or
|