TrainingConfig

class oci.generative_ai.models.TrainingConfig(**kwargs)

Bases: object

The fine-tuning method and hyperparameters used for fine-tuning a custom model.

Attributes

TRAINING_CONFIG_TYPE_LORA_TRAINING_CONFIG A constant which can be used with the training_config_type property of a TrainingConfig.
TRAINING_CONFIG_TYPE_TFEW_TRAINING_CONFIG A constant which can be used with the training_config_type property of a TrainingConfig.
TRAINING_CONFIG_TYPE_VANILLA_TRAINING_CONFIG A constant which can be used with the training_config_type property of a TrainingConfig.
early_stopping_patience Gets the early_stopping_patience of this TrainingConfig.
early_stopping_threshold Gets the early_stopping_threshold of this TrainingConfig.
learning_rate Gets the learning_rate of this TrainingConfig.
log_model_metrics_interval_in_steps Gets the log_model_metrics_interval_in_steps of this TrainingConfig.
total_training_epochs Gets the total_training_epochs of this TrainingConfig.
training_batch_size Gets the training_batch_size of this TrainingConfig.
training_config_type [Required] Gets the training_config_type of this TrainingConfig.

Methods

__init__(**kwargs) Initializes a new TrainingConfig object with values from keyword arguments.
get_subtype(object_dictionary) Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
TRAINING_CONFIG_TYPE_LORA_TRAINING_CONFIG = 'LORA_TRAINING_CONFIG'

A constant which can be used with the training_config_type property of a TrainingConfig. This constant has a value of “LORA_TRAINING_CONFIG”

TRAINING_CONFIG_TYPE_TFEW_TRAINING_CONFIG = 'TFEW_TRAINING_CONFIG'

A constant which can be used with the training_config_type property of a TrainingConfig. This constant has a value of “TFEW_TRAINING_CONFIG”

TRAINING_CONFIG_TYPE_VANILLA_TRAINING_CONFIG = 'VANILLA_TRAINING_CONFIG'

A constant which can be used with the training_config_type property of a TrainingConfig. This constant has a value of “VANILLA_TRAINING_CONFIG”

__init__(**kwargs)

Initializes a new TrainingConfig object with values from keyword arguments. This class has the following subclasses and if you are using this class as input to a service operations then you should favor using a subclass over the base class:

The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters:
  • training_config_type (str) – The value to assign to the training_config_type property of this TrainingConfig. Allowed values for this property are: “TFEW_TRAINING_CONFIG”, “VANILLA_TRAINING_CONFIG”, “LORA_TRAINING_CONFIG”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
  • total_training_epochs (int) – The value to assign to the total_training_epochs property of this TrainingConfig.
  • learning_rate (float) – The value to assign to the learning_rate property of this TrainingConfig.
  • training_batch_size (int) – The value to assign to the training_batch_size property of this TrainingConfig.
  • early_stopping_patience (int) – The value to assign to the early_stopping_patience property of this TrainingConfig.
  • early_stopping_threshold (float) – The value to assign to the early_stopping_threshold property of this TrainingConfig.
  • log_model_metrics_interval_in_steps (int) – The value to assign to the log_model_metrics_interval_in_steps property of this TrainingConfig.
early_stopping_patience

Gets the early_stopping_patience of this TrainingConfig. Stop training if the loss metric does not improve beyond ‘early_stopping_threshold’ for this many times of evaluation.

Returns:The early_stopping_patience of this TrainingConfig.
Return type:int
early_stopping_threshold

Gets the early_stopping_threshold of this TrainingConfig. How much the loss must improve to prevent early stopping.

Returns:The early_stopping_threshold of this TrainingConfig.
Return type:float
static get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

learning_rate

Gets the learning_rate of this TrainingConfig. The initial learning rate to be used during training

Returns:The learning_rate of this TrainingConfig.
Return type:float
log_model_metrics_interval_in_steps

Gets the log_model_metrics_interval_in_steps of this TrainingConfig. Determines how frequently to log model metrics.

Every step is logged for the first 20 steps and then follows this parameter for log frequency. Set to 0 to disable logging the model metrics.

Returns:The log_model_metrics_interval_in_steps of this TrainingConfig.
Return type:int
total_training_epochs

Gets the total_training_epochs of this TrainingConfig. The maximum number of training epochs to run for.

Returns:The total_training_epochs of this TrainingConfig.
Return type:int
training_batch_size

Gets the training_batch_size of this TrainingConfig. The batch size used during training.

Returns:The training_batch_size of this TrainingConfig.
Return type:int
training_config_type

[Required] Gets the training_config_type of this TrainingConfig. The fine-tuning method for training a custom model.

Allowed values for this property are: “TFEW_TRAINING_CONFIG”, “VANILLA_TRAINING_CONFIG”, “LORA_TRAINING_CONFIG”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns:The training_config_type of this TrainingConfig.
Return type:str