CompileJob

class CompileJob(job_pb, owner, device, compatible_devices, model, date, shapes, target_shapes, calibration_dataset)

Compile job for a model, a set of input specs, and a set of device.

A compile job should not be constructed directly. It is constructed by the hub client through qai_hub.submit_compile_job(), or qai_hub.get_job().

device

The device compiled for.

Type:

Device

compatible_devices

The devices compiled for in case of single compile.

Type:

List[Device]

model

The model for the job.

Type:

Model

date

The time this job was submitted.

Type:

datetime

shapes

The input specs for the model to be compiled.

Type:

InputSpecs

target_shapes

The input specs for the compiled model to run (profile or inference).

Type:

InputSpecs

calibration_dataset

The dataset used with post training quantization run during compilation.

Type:

Optional[Dataset]

disable_sharing()

Disable all sharing for this job.

戻り値の型:

None

download_results(artifacts_dir)

Returns all the results of a job.

This includes the compiled target model.

If the job is not ready, this function will block until completion.

パラメータ:

artifacts_dir (str) -- Directory name where the job artifacts are stored. If the directory does not exist, it is created.

戻り値:

Job results.

戻り値の型:

CompileJobResult

download_target_model(filename=None)

Returns the downloaded target model, either in memory or as a file.

If the job is not ready, this function will block until completion.

パラメータ:

filename (Optional[str]) -- If filename is specified the target model is downloaded to file, otherwise to memory.

戻り値:

The downloaded target model, filename, or None if the job failed.

戻り値の型:

TargetModel | str | None

get_sharing()

Get the list of email addresses of users that this job has been shared with.

戻り値の型:

List[str]

get_status()

Returns the status of a job.

戻り値:

The status of the job

戻り値の型:

JobStatus

get_target_model()

Returns the target model object. If the job is not ready, this function will block until completion.

戻り値:

The target model object, or None if the job failed.

戻り値の型:

TargetModel | None

modify_sharing(add_emails=[], delete_emails=[])

Modifies the list of users that the job is shared with.

All assets (models, datasets, artifacts, etc.) associated with the job will also be shared. For inference and profile jobs, the corresponding compile and link jobs (if any) will also be shared.

戻り値の型:

None

set_name(job_name)

Sets the name of a job to the specified value.

戻り値の型:

None

property url: str

Returns the URL for the job.

戻り値:

The URL for the job.

戻り値の型:

str

wait(timeout=None)

Block until this job finishes.

パラメータ:

timeout (Optional[int]) --

If provided, a TimeoutError will be raised after waiting this many seconds.

If None, this client will not time out the job, meaning it will block an indefinite amount of time waiting for the job to finish.

HOWEVER, Qualcomm AI Hub will fail / time out any job a set amount of time after its creation. Therefore, even if timeout is None, the runtime of this method will still have a finite upper bound.

戻り値:

The final, "finished" (SUCCESS or FAILED) status for this job.

戻り値の型:

str

例外:

TimeoutError -- Raised only if a client-side timeout occurs, when param "timeout" != None. If the Qualcomm AI Hub server times out the job, this error will NOT be raised, and a FAILED job status will be returned instead.