oumi.cli#

Submodules#

oumi.cli.alias module#

class oumi.cli.alias.AliasType(value)[source]#

Bases: str, Enum

The type of configs we support with aliases.

EVAL = 'eval'#
INFER = 'infer'#
JOB = 'job'#
TRAIN = 'train'#
oumi.cli.alias.try_get_config_name_for_alias(alias: str, alias_type: AliasType) str[source]#

Gets the config path for a given alias.

This function resolves the config path for a given alias and alias type. If the alias is not found, the original alias is returned.

Parameters:
  • alias (str) – The alias to resolve.

  • alias_type (AliasType) – The type of config to resolve.

Returns:

The resolved config path (or the original alias if not found).

Return type:

str

oumi.cli.cli_utils module#

class oumi.cli.cli_utils.LogLevel(value)[source]#

Bases: str, Enum

The available logging levels.

CRITICAL = 'CRITICAL'#
DEBUG = 'DEBUG'#
ERROR = 'ERROR'#
INFO = 'INFO'#
WARNING = 'WARNING'#
oumi.cli.cli_utils.configure_common_env_vars() None[source]#

Sets common environment variables if needed.

oumi.cli.cli_utils.parse_extra_cli_args(ctx: Context) list[str][source]#

Parses extra CLI arguments into a list of strings.

Parameters:

ctx – The Typer context object.

Returns:

The extra CLI arguments

Return type:

List[str]

oumi.cli.cli_utils.resolve_and_fetch_config(config_path: str, output_dir: Path | None = None, force: bool = True) Path[source]#

Resolve oumi:// prefix and fetch config if needed.

Parameters:
  • config_path – Original config path that may contain oumi:// prefix

  • output_dir – Optional override for output directory

  • force – Whether to overwrite an existing config

Returns:

Local path to the config file

Return type:

Path

oumi.cli.cli_utils.section_header(title, console: ~rich.console.Console = <console width=80 None>)[source]#

Print a section header with the given title.

Parameters:
  • title – The title text to display in the header.

  • console – The Console object to use for printing.

oumi.cli.cli_utils.set_log_level(level: LogLevel | None)[source]#

Sets the logging level for the current command.

Parameters:

level (Optional[LogLevel]) – The log level to use.

oumi.cli.distributed_run module#

oumi.cli.distributed_run.accelerate(ctx: ~typer.models.Context, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Starts accelerate sub-process w/ automatically configured common params.

Parameters:
  • ctx – The Typer context object.

  • level – The logging level for the specified command.

oumi.cli.distributed_run.torchrun(ctx: ~typer.models.Context, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Starts torchrun sub-process w/ automatically configured common params.

Parameters:
  • ctx – The Typer context object.

  • level – The logging level for the specified command.

oumi.cli.env module#

oumi.cli.env.env()[source]#

Prints information about the current environment.

oumi.cli.evaluate module#

oumi.cli.evaluate.evaluate(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face75563d0>], level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Evaluate a model.

Parameters:
  • ctx – The Typer context object.

  • config – Path to the configuration file for evaluation.

  • level – The logging level for the specified command.

oumi.cli.fetch module#

oumi.cli.fetch.fetch(config_path: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7face726fc50>], output_dir: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7face726d450>] = None, force: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7face72ab890>] = False) None[source]#

Fetch configuration files from GitHub repository.

oumi.cli.infer module#

oumi.cli.infer.infer(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face722d450>], interactive: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7face7248d10>] = False, image: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face724a350>] = None, system_prompt: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face724a4d0>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Run inference on a model.

If input_filepath is provided in the configuration file, inference will run on those input examples. Otherwise, inference will run interactively with user-provided inputs.

Parameters:
  • ctx – The Typer context object.

  • config – Path to the configuration file for inference.

  • output_dir – Directory to save configs

  • ~/.oumi/fetch). ((defaults to OUMI_DIR env var or)

  • interactive – Whether to run in an interactive session.

  • image – Path to the input image for image+text VLLMs.

  • system_prompt – System prompt for task-specific instructions.

  • level – The logging level for the specified command.

oumi.cli.judge module#

oumi.cli.judge.conversations(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7272b50>], input_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face72729d0>] = None, output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7272810>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Judge a list of conversations.

oumi.cli.judge.dataset(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7272e90>], dataset_name: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7273990>] = None, dataset_subset: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face72725d0>] = None, dataset_split: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7272dd0>] = 'train', output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7272c90>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Judge a dataset.

oumi.cli.judge.model(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7271dd0>], inference_config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7271d90>], input_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7272490>] = None, output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7272110>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Judge the outputs of a model on a dataset.

oumi.cli.launch module#

oumi.cli.launch.cancel(cloud: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face722f910>], cluster: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face722c850>], id: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face722e910>], level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Cancels a job.

Parameters:
  • cloud – Filter results by this cloud.

  • cluster – Filter results by clusters matching this name.

  • id – Filter results by jobs matching this job ID.

  • level – The logging level for the specified command.

oumi.cli.launch.down(cluster: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7227550>], cloud: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face722e5d0>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Turns down a cluster.

Parameters:
  • cluster – The cluster to turn down.

  • cloud – If specified, only clusters on this cloud will be affected.

  • level – The logging level for the specified command.

oumi.cli.launch.run(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face722e650>], cluster: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face722f490>] = None, detach: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7face722ef50>] = False, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Runs a job on the target cluster.

Parameters:
  • ctx – The Typer context object.

  • config – Path to the configuration file for the job.

  • cluster – The cluster to use for this job. If no such cluster exists, a new cluster will be created. If unspecified, a new cluster will be created with a unique name.

  • detach – Run the job in the background.

  • level – The logging level for the specified command.

oumi.cli.launch.status(cloud: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7278650>] = None, cluster: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7249090>] = None, id: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face7249510>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Prints the status of jobs launched from Oumi.

Optionally, the caller may specify a job id, cluster, or cloud to further filter results.

Parameters:
  • cloud – Filter results by this cloud.

  • cluster – Filter results by clusters matching this name.

  • id – Filter results by jobs matching this job ID.

  • level – The logging level for the specified command.

oumi.cli.launch.stop(cluster: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7248650>], cloud: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face72a9e50>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Stops a cluster.

Parameters:
  • cluster – The cluster to stop.

  • cloud – If specified, only clusters on this cloud will be affected.

  • level – The logging level for the specified command.

oumi.cli.launch.up(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face72abc10>], cluster: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7face72a9790>] = None, detach: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7face7214e90>] = False, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Launches a job.

Parameters:
  • ctx – The Typer context object.

  • config – Path to the configuration file for the job.

  • cluster – The cluster to use for this job. If no such cluster exists, a new cluster will be created. If unspecified, a new cluster will be created with a unique name.

  • detach – Run the job in the background.

  • level – The logging level for the specified command.

oumi.cli.launch.which(level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None) None[source]#

Prints the available clouds.

oumi.cli.main module#

oumi.cli.main.get_app() Typer[source]#

Create the Typer CLI app.

oumi.cli.main.run()[source]#

The entrypoint for the CLI.

oumi.cli.train module#

oumi.cli.train.train(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7face7310690>], level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7facea7f0150>] = None)[source]#

Train a model.

Parameters:
  • ctx – The Typer context object.

  • config – Path to the configuration file for training.

  • level – The logging level for the specified command.