shreyajn commited on
Commit
a64da14
·
verified ·
1 Parent(s): 87131e8

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +10 -27
README.md CHANGED
@@ -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.quicksrnetlarge 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
 
120
  import torch
121
 
122
  import qai_hub as hub
123
+ from qai_hub_models.models.quicksrnetlarge 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