qai_hub.upload_model
- upload_model(model, name=None)
Uploads a model.
- Parameters:
model (
Union
[TopLevelTracedModule
,MLModel
,ModelProto
,bytes
,str
]) – In memory representation or filename of the model to upload.name (
Optional
[str
]) – Optional name of the model. If a name is not specified, it is decided either based on the model or the file name.
- Returns:
model – Returns a model if successful.
- Return type:
- Raises:
UserError – Failure in the model input.
Examples
import qai_hub as hub import torch pt_model = torch.jit.load("model.pt") # Upload model model = hub.upload_model(pt_model) # Jobs can now be scheduled using this model device = hub.Device("Samsung Galaxy S23", "12") cjob = hub.submit_compile_job(model, device=device, name="pt_model (1, 3, 256, 256)", input_shapes=dict(x=(1, 3, 256, 256))) model = cjob.get_target_model() pjob = hub.submit_profile_job(model, device=device, name="pt_model (1, 3, 256, 256)")