Skip to content

Utilities

These packages provide experiment setup and deployment helpers.

cli

Utilities for commandline usage of experiments.

This module provides common utilities for commandline usage of experiments. It is intended to be used as a library for writing commandline interfaces for experiments.

Functions:

initialize

initialize(**kwargs: Any) -> DictConfig | ListConfig

Initialize the experiment environment.

Loads the configuration and sets up logging according to its settings.

Parameters:

Name Type Description Default
**kwargs Any

Additional configuration overrides.

{}

Returns:

Type Description
DictConfig | ListConfig

The initialized configuration object.

utils

Functions:

get_seed

get_seed() -> int

Generate a random seed.

Returns:

Type Description
int

A random seed.

initialize_random

initialize_random(seed: int) -> None

Initialize the random number generator with the given seed.

Parameters:

Name Type Description Default
seed int

The seed to initialize the random number generator with.

required

build_environments_from_directory

build_environments_from_directory(path: Path | str, builder: EnvironmentBuilder, *, pattern: str = '*', include_files: bool = True, include_folders: bool = True) -> Iterable[OfflineEnvironment]

Build environments from a directory.

This helper function can be used to build environments from multiple files or folders. First all files and folders in the path matching the pattern are selected. These are then passed to the builder function which creates the environment.

Parameters:

Name Type Description Default
path Path | str

The path to the directory from which environments are created.

required
builder EnvironmentBuilder

A function building an environment from a path and returning it.

required
pattern str

A glob pattern. Matching files and folders will be passed to builder.

'*'
include_files bool

Specify whether to pass files to builder.

True
include_folders bool

Specify whether to pass folders to builder.

True

tool

Functions:

start_prediction_loop

start_prediction_loop(model: Model, adapter: Adapter, *, adapter_to_model_transforms: Transform | None = None, model_to_adapter_transforms: Transform | None = None) -> None

Start a prediction loop with the given model and adapter.