Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tracebloc.io/llms.txt

Use this file to discover all available pages before exploring further.

Training Parameters

All parameters are set through the training_plan after linking your model with the dataset.
training_plan = user.link_model_dataset(dataset_id='Dataset ID')
To see all current parameter settings, run training_plan.get_training_plan(). To run consecutive experiments, overwrite parameters and re-start training with training_plan.start().
You can refer to the TensorFlow Documentation for more information on TensorFlow augmentation parameters and the PyTorch Documentation for more information on PyTorch augmentation parameters.
Basic training configuration parameters that control the fundamental aspects of your training process.
ParameterDescriptionDefaultExample
EpochsNumber of complete passes through the entire dataset10training_plan.epochs(100)
CyclesNumber of complete passes through training and validation datasets1training_plan.cycles(10)
Batch SizeNumber of samples processed at one time. Set automatically from the batch_size variable in your model fileDatatype dependent
16 in most cases
Set via batch_size = 16 in your model .py file
Validation SplitPercentage of dataset used for validation (0-1)Dataset dependent
20% in most cases
training_plan.validation_split(0.2)

Core Hyperparameters

1. Optimizer

Controls how the model’s parameters are updated during training. Supports different optimizers for TensorFlow and PyTorch. The default optimizer is SGD for both PyTorch and TensorFlow. Supported Optimizers:
  • TensorFlow: adam, rmsprop, sgd, adadelta, adagrad, adamax, nadam, ftrl
  • PyTorch: adam, rmsprop, sgd, adadelta, adagrad, adamax
training_plan.optimizer('rmsprop')

2. Learning Rate

Controls the rate at which the model learns. Supports three different types:
TypeDescriptionFramework SupportExample
ConstantFixed learning rate throughout trainingTensorFlow, PyTorchtraining_plan.learning_rate({'type': 'constant', 'value': 0.002})
AdaptiveLearning rate that changes based on scheduleTensorFlowtraining_plan.learning_rate({'type': 'adaptive', 'value': {'decay_rate': 0.9, 'decay_steps': 100, 'initial_learning_rate': 0.1, 'scheduler': 'ExponentialDecay'}})
CustomUser-defined learning rate functionTensorFlowtraining_plan.learning_rate({'type': 'custom', 'value': {'name': custom_function, 'epoch': 5}})
Default: {'type': 'constant', 'value': 0.001}
  • Custom for TensorFlow: Define a custom learning rate function, then pass it via learning_rate() with type: 'custom':
    def custom_LearningRate_scheduler(epoch):
            if epoch < 5:
                return 0.01
            else:
                return 0.01 * tf.math.exp(0.1 * (10 - epoch))
    training_plan.learning_rate({'type': 'custom', 'value': {'name': custom_LearningRate_scheduler, 'epoch': 5}})
    

3. Loss Function

Defines how the model measures prediction errors. Supports standard and custom loss functions. It is implemented similarly to the built-in loss function in TensorFlow. Supported Loss Functions:
  • TensorFlow: binary_crossentropy, categorical_crossentropy, mse, custom loss functions
  • PyTorch: crossentropy, mse, l1
# Standard loss function
training_plan.loss_function({'type': 'standard', 'value': 'categorical_crossentropy'})

# Custom loss function (TensorFlow only)
def custom_mse(y_true, y_pred):
	# calculating squared difference between target and predicted values
	loss = K.square(y_pred - y_true)  # (batch_size, 2)

	# multiplying the values with weights along batch dimension
	loss = loss * [0.3, 0.7]          # (batch_size, 2)

	# summing both loss values along batch dimension
	loss = K.sum(loss, axis=1)        # (batch_size,)

	return loss
training_plan.loss_function({'type': 'custom', 'value': custom_mse})
Default: {'type': 'standard', 'value': 'mse'}

Training Control

Layer Freezing

Specify which layers should remain unchanged during training (TensorFlow only):
training_plan.layers_freeze(['conv1','fc1'])
Layer freezing is currently supported for TensorFlow models only. PyTorch models will receive a “not supported” message.

Callbacks

Control training behavior with various callbacks:
CallbackPurposeParametersExample
Early StoppingStop training when metric stops improvingmetric, patiencetraining_plan.early_stop_callback('loss', 10)
Reduce LRReduce learning rate when metric plateausmetric, factor, patience, thresholdtraining_plan.reduce_lr_callback('loss', 0.1, 10, 0.0001)
Model CheckpointSave model weights at specific intervalsmetric, save_best_onlytraining_plan.model_checkpoint_callback('val_loss', True)
Terminate on NaNStop training if validation loss becomes NaNNonetraining_plan.terminate_on_nan_callback()

Data Augmentation for Image Data

Enhance your dataset with real-time image transformations. All parameters support both TensorFlow and PyTorch unless noted otherwise.

Geometric Transformations

ParameterDescriptionDefaultFramework SupportExample
rotation_rangeDegree range for random rotations. For example, if the rotation_range is set to 2, images will be rotated by a random degree between -2 and 20TensorFlow, PyTorchtraining_plan.rotation_range(2)
width_shift_rangeRange for horizontal shifts (float: fraction, int: pixels). If the value is a float less than 1, it represents a fraction of total width; otherwise it represents pixels. Integers represent pixel values from the interval (-width_shift_range, +width_shift_range)0.0TensorFlow, PyTorchtraining_plan.width_shift_range(0.1)
height_shift_rangeRange for vertical shifts (float: fraction, int: pixels). Works like width_shift_range0.0TensorFlow, PyTorchtraining_plan.height_shift_range(0.1)
shear_rangeShear intensity in degrees in counter-clockwise direction0.0TensorFlowtraining_plan.shear_range(0.2)
zoom_rangeRange for zooming (float or list). If the value is a float, then zoom range is defined as [1-zoom_range, 1+zoom_range]. If the value is a list, it represents the range of zoom0.0TensorFlow, PyTorchtraining_plan.zoom_range(0.1), training_plan.zoom_range([0.2, 0.8])
horizontal_flipRandomly flip images horizontallyFalseTensorFlowtraining_plan.horizontal_flip(True)
vertical_flipRandomly flip images verticallyFalseTensorFlowtraining_plan.vertical_flip(True)

Color and Intensity Transformations

ParameterDescriptionDefaultFramework SupportExample
brightness_rangeRange for brightness shifts (tuple of floats)NoneTensorFlow, PyTorchtraining_plan.brightness_range((0.1,0.4))
channel_shift_rangeRange for random channel shifts0TensorFlow, PyTorch*training_plan.channel_shift_range(0.4)
rescaleRescaling factor for pixel values (float)NoneTensorFlow, PyTorchtraining_plan.rescale(1.0/255.0)
*PyTorch: Only supported for RGB images

Normalization

ParameterDescriptionDefaultFramework SupportExample
samplewise_centerCenter each image by subtracting meanFalseTensorFlowtraining_plan.samplewise_center(True)
samplewise_std_normalizationStandardize each image by subtracting the mean and dividing by the standard deviation of pixel values. Calculated individuallyFalseTensorFlowtraining_plan.samplewise_std_normalization(True)

Other Parameters

ParameterDescriptionDefaultFramework SupportExample
fill_modeMethod for filling points outside boundaries. Supported for TensorFlow: “constant”, “nearest”, “reflect”, “wrap”. For PyTorch: “constant”, “edge”, “symmetric”, “reflect”, “wrap”.‘constant’TensorFlow, PyTorchtraining_plan.fill_mode("nearest")
cvalFill value for points outside the image boundaries when fill_mode=“constant”0.0TensorFlow, PyTorchtraining_plan.cval(0.3)
shuffleWhether to shuffle the dataTrueTensorFlow, PyTorchtraining_plan.shuffle(True)

LLM Parameters (Text Classification)

For text classification tasks in PyTorch, you can enable and configure LoRA (Low-Rank Adaptation) parameters:
# Enable LoRA first
training_plan.enable_lora(True)

# Configure LoRA parameters (positional arguments: lora_r, lora_alpha, lora_dropout, q_lora)
training_plan.set_lora_parameters(256, 512, 0.05, False)
ParameterDescriptionTypeDefaultExample
lora_rRank for the LoRA layerPositive integer256lora_r=256
lora_alphaScaling factor alpha for LoRAPositive integer512lora_alpha=512
lora_dropoutDropout rate for LoRA layersFloat (0-1)0.05lora_dropout=0.05
q_loraEnable or disable Q LoRABooleanFalseq_lora=False
Note: LLM parameters are supported only for PyTorch.

Dataset Parameters (Optional)

Customize your dataset configuration and preprocessing options:

Dataset Customization

ParameterDescriptionExample
training_classesCustomize dataset by specifying samples per classtraining_plan.training_classes({'car': 30, 'person': 30})
data_typeImage format: ‘rgb’ or ‘grayscale’training_plan.data_type('rgb')
seedSet global random seedtraining_plan.seed(True)

Next Steps


Need Help?

For more info about available functions and methods, call the help function in your notebook:
user.help()