chariot.bulk_inference package

Submodules

chariot.bulk_inference.job module

chariot.bulk_inference.job.create_bulk_inference_job(job_spec: NewBulkInferenceJobRequest) str | None[source]

Create a bulk inference job.

Parameters:

job_spec (models.NewBulkInferenceJobRequest) – The bulk inference job specification.

Returns:

The bulk inference job id.

Return type:

Optional[str]

chariot.bulk_inference.job.get_bulk_inference_job(job_id: str) BulkInferenceJob | None[source]

Get a bulk inference job.

Parameters:

job_id (str) – The bulk inference job id.

Returns:

The bulk inference job.

Return type:

Optional[BulkInferenceJob]

chariot.bulk_inference.job.get_bulk_inference_jobs(model_id: str, dataset_version_id: str | None = None, dataset_snapshot_id: str | None = None, dataset_version_split: str | None = None, inference_method: str | None = None, limit: int | None = None, offset: int | None = None) list[BulkInferenceJob][source]

Get bulk inference jobs.

Parameters:
  • model_id (str) – The model id.

  • dataset_version_id (Optional[str]) – Optional dataset version ID. Defaults to None.

  • dataset_snapshot_id (Optional[str]) – Optional dataset snapshot ID. Defaults to None.

  • dataset_version_split (Optional[str]) – Optional dataset snapshot split. Defaults to None.

  • inference_method (Optional[str]) – Optional model inference method. Defaults to None.

  • limit (Optional[int]) – Optional pagination limit. Defaults to None.

  • offset (Optional[int]) – Optional pagination offset. Defaults to None.

Returns:

.

Return type:

List[BulkInferenceJob]

chariot.bulk_inference.models module

class chariot.bulk_inference.models.BulkInferenceJob(*, execution_id: str, execution_status: str, num_computed: int | None = None, expected_total: int | None = None)[source]

Bases: BaseModel

Information about a previously created bulk inference job.

Parameters:
  • execution_id (str) – The ID of this bulk inference job.

  • execution_status (str) – The status of this job.

  • num_computed (int | None) – The number of inferences completed so far in this job.

  • expected_total (int | None) – The total number of datums to infer on in this job.

execution_id: str
execution_status: str
expected_total: int | None
property job_id

The ID of this bulk inference job.

property job_status: ProgressState

The status of this bulk inference job.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_computed: int | None
class chariot.bulk_inference.models.NewBulkInferenceJobRequest(*, model_project_id: str, model_id: str, dataset_project_id: str, dataset_id: str, dataset_snapshot_id: str, dataset_snapshot_split: str, inference_method: str = '', evaluate_metrics: bool = False, batch_size: int = 1)[source]

Bases: BaseModel

A request to create a new bulk inference job.

Parameters:
  • model_project_id (str) – The project ID of the project containing the model.

  • model_id (str) – The model ID of the model to use for inference.

  • dataset_project_id (str) – The project ID of the project containing the snapshot to infer on.

  • dataset_id (str) – The dataset ID dataset containing the snapshot to infer on.

  • dataset_snapshot_id (str) – The ID of the snapshot to infer on.

  • dataset_snapshot_split (str) – The split of the snapshot to infer on.

  • inference_method (str) – The inference method (AKA action) to use for inference. Only needed for task types that support multiple inference methods. Defaults to “”, meaning the default action will be chosen for task types supporting only a single action.

  • evaluate_metrics (bool) – Whether to use Valor to perform an evalaution after inference is complete. When evaluate_metrics is true, only snapshot datums with annotations will be infered on. To infer over unannotated data, set this to false. Defaults to false.

  • batch_size (int) – The batch size to use for inference. Datums will be sent to inference servers in groups of this size.

batch_size: int
dataset_id: str
dataset_project_id: str
dataset_snapshot_id: str
dataset_snapshot_split: str
evaluate_metrics: bool
inference_method: str
model_config: ClassVar[ConfigDict] = {'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_id: str
model_project_id: str
class chariot.bulk_inference.models.ProgressState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

The status of a bulk inference job.

ABORTED = 'aborted'
FAILED = 'failed'
INITIALIZED = 'initialized'
IN_PROGRESS = 'in_progress'
RUNNING = 'running'
RUNNING_FAILED = 'running_failed'
SUCCEEDED = 'succeeded'

Module contents