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 0x7fe12df379d0>] = 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 0x7fe12df379d0>] = 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 0x7fe107aabe50>], level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe10772aa10>], output_dir: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7fe107dd7b50>] = None, force: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7fe107702890>] = 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 0x7fe107765250>], interactive: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7fe107700cd0>] = False, image: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe107700e50>] = None, system_prompt: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe107700e10>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe1079bc5d0>], input_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bc6d0>] = None, output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bc850>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = None)[source]#

Judge a list of conversations.

oumi.cli.judge.dataset(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe1079bc250>], dataset_name: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe107765c90>] = None, dataset_subset: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bc390>] = None, dataset_split: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bc450>] = 'train', output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bc510>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = None)[source]#

Judge a dataset.

oumi.cli.judge.model(ctx: ~typer.models.Context, config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe1079bc910>], inference_config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe1079bc950>], input_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bca90>] = None, output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079bcb50>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = None)[source]#

Judge the outputs of a model on a dataset.

oumi.cli.judge_v2 module#

oumi.cli.judge_v2.judge_file(ctx: ~typer.models.Context, judge_config: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe1079c1910>], input_file: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe1079c1710>], output_file: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1079c1490>] = None, display_raw_output: bool = False)[source]#

Judge a dataset.

oumi.cli.launch module#

oumi.cli.launch.cancel(cloud: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe107f241d0>], cluster: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe10792dc90>], id: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7fe107717c90>], level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe1077c59d0>], cloud: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1077c5b50>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe1077c6cd0>], cluster: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1077c61d0>] = None, detach: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7fe1077c6190>] = False, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe1077c51d0>] = None, cluster: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1077c6a50>] = None, id: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1077c7710>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe1077c7850>], cloud: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1077c72d0>] = None, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe1077c5d10>], cluster: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7fe1077c6090>] = None, detach: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7fe1077c4990>] = False, level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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 0x7fe12df379d0>] = None) None[source]#

Prints the available clouds.

oumi.cli.main module#

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

Check if the experimental judge v2 feature is enabled.

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 0x7fe107916110>], level: ~typing.Annotated[~oumi.cli.cli_utils.LogLevel | None, <typer.models.OptionInfo object at 0x7fe12df379d0>] = 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.