Skip to content

core.services.context.local_context

local_context

Functions:

Name Description
create_local_dataset_processing_context

Create a local processing context for running a processing pipeline outside of Picsellia.

create_local_datalake_processing_context

Create a local context for datalake processing pipelines.

create_local_model_processing_context
create_local_training_context

Create a local training context for running a training pipeline outside of Picsellia.

create_local_dataset_processing_context(processing_parameters_cls, organization_name, job_type, input_dataset_version_id, target_version_name=None, output_dataset_version_id=None, target_id=None, model_version_id=None, processing_parameters=None, working_dir=None, api_token=None, host=None, inputs=None, use_id=True, download_annotations=True)

Create a local processing context for running a processing pipeline outside of Picsellia.

This is typically used for development and testing, with full local control over input/output paths and parameter overrides.

Parameters:

Name Type Description Default

processing_parameters_cls

type[TParameters]

A subclass of Parameters used to define typed inputs.

required

api_token

str

API token for authentication with Picsellia.

None

organization_name

str

Name of the Picsellia organization.

required

job_type

ProcessingType

Type of processing job (e.g., PRE_ANNOTATION, DATASET_VERSION_CREATION).

required

input_dataset_version_id

str

ID of the dataset version used as input.

required

target_version_name

str | None

Optional name for the output dataset version.

None

output_dataset_version_id

str | None

Optional ID of an existing dataset version to use as output.

None

target_id

str | None

Optional ID of the processing target.

None

model_version_id

str | None

Optional ID of a model version to include in the context.

None

processing_parameters

dict[str, Any] | None

Raw values to override defaults in the processing parameters.

None

working_dir

str | None

Optional working directory for local file operations.

None

host

str | None

Optional Picsellia API host override.

None

inputs

dict[str, Any] | None

Optional dictionary of additional inputs to include in the context.

None

use_id

bool

Whether to use asset IDs or paths in output annotations.

True

download_annotations

bool

Whether to download annotations for the input dataset version.

True

Returns:

Type Description
LocalDatasetProcessingContext

LocalDatasetProcessingContext[TParameters]: A fully initialized local processing context.

create_local_datalake_processing_context(processing_parameters_cls, organization_name, job_type, input_datalake_id, output_datalake_id=None, model_version_id=None, target_id=None, inputs=None, offset=0, limit=100, use_id=True, processing_parameters=None, working_dir=None, api_token=None, host=None)

Create a local context for datalake processing pipelines.

Parameters:

Name Type Description Default

processing_parameters_cls

type[TParameters]

Class used to parse processing parameters.

required

api_token

str | None

Your Picsellia API token.

None

organization_name

str

Name of your organization.

required

job_type

ProcessingType

Type of processing job.

required

input_datalake_id

str

ID of the input datalake.

required

output_datalake_id

str | None

Optional ID of the output datalake.

None

model_version_id

str | None

Optional ID of the model version.

None

target_id

str | None

Optional ID of the processing target.

None

inputs

dict[str, Any] | None

Optional dictionary of additional inputs to include in the context.

None

offset

int

Data offset for datalake slicing.

0

limit

int

Max number of samples to fetch.

100

use_id

bool

Whether to use asset ID or path in output annotations.

True

processing_parameters

dict[str, Any] | None

Raw values to override defaults in the processing parameters.

None

working_dir

str | None

Optional working directory.

None

host

str | None

Optional custom API host.

None

Returns:

Type Description
LocalDatalakeProcessingContext

LocalDatalakeProcessingContext

create_local_model_processing_context(processing_parameters_cls, organization_name, job_type, input_model_version_id, target_id=None, inputs=None, processing_parameters=None, working_dir=None, api_token=None, host=None)

create_local_training_context(hyperparameters_cls, augmentation_parameters_cls, export_parameters_cls, organization_name, experiment_id, hyperparameters=None, augmentation_parameters=None, export_parameters=None, working_dir=None, api_token=None, host=None)

Create a local training context for running a training pipeline outside of Picsellia.

This is typically used for development and debugging, with full local control over hyperparameters, augmentation strategies, and export configuration. Parameters can be pulled from the experiment logs or overridden manually.

Parameters:

Name Type Description Default

hyperparameters_cls

type[HyperParameters]

Class defining the training hyperparameters.

required

augmentation_parameters_cls

type[AugmentationParameters]

Class defining data augmentation parameters.

required

export_parameters_cls

type[ExportParameters]

Class defining model export parameters.

required

api_token

str

API token for authentication with Picsellia.

None

organization_name

str

Name of the Picsellia organization.

required

experiment_id

str

ID of the experiment from which to load parameter logs.

required

hyperparameters

dict[str, Any] | None

Optional overrides for training hyperparameters.

None

augmentation_parameters

dict[str, Any] | None

Optional overrides for augmentation parameters.

None

export_parameters

dict[str, Any] | None

Optional overrides for export parameters.

None

working_dir

str | None

Optional working directory for local file operations.

None

host

str | None

Optional Picsellia API host override.

None

Returns:

Name Type Description
LocalTrainingContext LocalTrainingContext

A fully initialized local training context.