Skip to content

API reference

Public Python surface for TRLoom.

Quick usage

from trloom import FineTuneJob, load_config, run_from_yaml, available_methods

print(available_methods())

run_from_yaml("sft.yaml")

job = FineTuneJob.from_yaml("sft.yaml")
job.build()
job.run()

Job orchestration

trloom.job.FineTuneJob

FineTuneJob(config: FineTuneConfig)

Load a YAML config, build a TRL trainer, and run training end-to-end.

from_yaml classmethod

from_yaml(path: str | Path) -> FineTuneJob

Create a job from a YAML configuration file.

from_dict classmethod

from_dict(data: dict[str, Any]) -> FineTuneJob

Create a job from an in-memory configuration dictionary.

build

build() -> Any

Construct (but do not train) the underlying TRL trainer.

train

train() -> Any

Build the trainer if needed and run trainer.train().

run

run() -> Any

Alias for :meth:train — run the fine-tuning job end-to-end.

trloom.job.run_from_yaml

run_from_yaml(path: str | Path, *, use_modal: bool | None = None) -> Any

Load a YAML config and run the fine-tuning job.

Parameters

path: Path to a TRLoom YAML configuration file. use_modal: If True, force Modal execution. If None, follow modal.enabled in the config. If False, always run locally.

trloom.job.available_methods

available_methods(*, include_experimental: bool = True) -> list[str]

List training methods supported by the installed TRL version.

Configuration

trloom.config.schema.FineTuneConfig

Bases: BaseModel

Root configuration for a TRLoom fine-tuning job.

trloom.config.schema.ModelConfig

Bases: BaseModel

Model / PEFT / quantization settings (mirrors TRL ModelConfig fields).

trloom.config.schema.DatasetConfig

Bases: BaseModel

Dataset loading configuration.

Prefer path for a single Hub/local dataset, or datasets for a mixture.

trloom.config.schema.DatasetSourceConfig

Bases: BaseModel

A single dataset entry (Hub repo id or local path).

trloom.config.schema.WandbConfig

Bases: BaseModel

Weights & Biases logging settings.

trloom.config.schema.ModalConfig

Bases: BaseModel

Modal Labs remote execution settings.

trloom.config.loader.load_config

load_config(source: str | Path | dict[str, Any]) -> FineTuneConfig

Load and validate a :class:FineTuneConfig from YAML or a dict.

Trainers

trloom.trainers.registry.list_trainers

list_trainers(*, include_experimental: bool = True) -> list[str]

Return sorted method names available from the installed TRL version.