nat.data_models.finetuning#
Attributes#
Classes#
Configuration for the reward function |
|
Base configuration for the Trainer |
|
Configuration for the trajectory collector |
|
Configuration for the trainer adapter |
|
A reference to a training job. |
|
str(object='') -> str |
|
The status of a training job. |
|
str(object='') -> str |
|
A single step in an episode. |
|
A message in the OpenAI chat format. |
|
A single step in an episode for DPO training. |
|
A trajectory is a sequence of states, actions, and rewards. |
|
A collection of trajectories. |
|
Configuration for curriculum learning in fine-tuning. |
|
CLI Args for running finetuning and configuring |
|
Parameters used for a Trainer run |
Module Contents#
- logger#
- class RewardFunctionConfig(/, **data: Any)#
Bases:
pydantic.BaseModelConfiguration for the reward function
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.
- class TrainerConfig(/, **data: Any)#
Bases:
nat.data_models.common.TypedBaseModel,nat.data_models.common.BaseModelRegistryTagBase configuration for the Trainer
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- reward: RewardFunctionConfig | None = None#
- class TrajectoryBuilderConfig(/, **data: Any)#
Bases:
nat.data_models.common.TypedBaseModel,nat.data_models.common.BaseModelRegistryTagConfiguration for the trajectory collector
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- reward: RewardFunctionConfig | None = None#
- class TrainerAdapterConfig(/, **data: Any)#
Bases:
nat.data_models.common.TypedBaseModel,nat.data_models.common.BaseModelRegistryTagConfiguration for the trainer adapter
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- reward: RewardFunctionConfig | None = None#
- TrainerConfigT#
- TrajectoryBuilderConfigT#
- TrainerAdapterConfigT#
- class TrainingJobRef(/, **data: Any)#
Bases:
pydantic.BaseModelA reference to a training job.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.
- class TrainingStatusEnum#
-
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
Initialize self. See help(type(self)) for accurate signature.
- PENDING = 'pending'#
- RUNNING = 'running'#
- COMPLETED = 'completed'#
- FAILED = 'failed'#
- CANCELED = 'canceled'#
- class TrainingJobStatus(/, **data: Any)#
Bases:
pydantic.BaseModelThe status of a training job.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- status: TrainingStatusEnum = None#
- class EpisodeItemRole#
-
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
Initialize self. See help(type(self)) for accurate signature.
- USER = 'user'#
- ASSISTANT = 'assistant'#
- SYSTEM = 'system'#
- FUNCTION = 'function'#
- TOOL = 'tool'#
- ENVIRONMENT = 'environment'#
- OTHER = 'other'#
- class EpisodeItem(/, **data: Any)#
Bases:
pydantic.BaseModelA single step in an episode.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- role: EpisodeItemRole = None#
- check_logprobs() EpisodeItem#
- class OpenAIMessage(/, **data: Any)#
Bases:
pydantic.BaseModelA message in the OpenAI chat format.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.
- class DPOItem(/, **data: Any)#
Bases:
pydantic.BaseModelA single step in an episode for DPO training.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- prompt: list[OpenAIMessage] | str = None#
- class Trajectory(/, **data: Any)#
Bases:
pydantic.BaseModelA trajectory is a sequence of states, actions, and rewards.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- episode: list[EpisodeItem] | list[DPOItem] = None#
- class TrajectoryCollection(/, **data: Any)#
Bases:
pydantic.BaseModelA collection of trajectories.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- trajectories: list[list[Trajectory]] = None#
- class CurriculumLearningConfig(/, **data: Any)#
Bases:
pydantic.BaseModelConfiguration for curriculum learning in fine-tuning.
Curriculum learning progressively introduces harder training examples to improve model learning and convergence.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- validate_percentiles() CurriculumLearningConfig#
Validate that percentile values are in valid range.
- class FinetuneRunConfig(/, **data: Any)#
Bases:
pydantic.BaseModelCLI Args for running finetuning and configuring
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- config_file: pathlib.Path | pydantic.BaseModel = None#
- dataset: str | pathlib.Path | None = None#
- validation_dataset: str | pathlib.Path | None = None#
- validation_config_file: str | pathlib.Path | None = None#
- class FinetuneConfig(/, **data: Any)#
Bases:
pydantic.BaseModelParameters used for a Trainer run
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- reward_function: RewardFunctionConfig | None = None#
- curriculum_learning: CurriculumLearningConfig = None#
- output_dir: pathlib.Path = None#
- run_configuration: FinetuneRunConfig | None = None#