model_components.callbacks package
Submodules
model_components.callbacks.custom_save_weights module
- class model_components.callbacks.custom_save_weights.CustomSaveWeights(weights_folder, save_weights_mode, save_weights_silent=False)
Bases:
Callback
Custom Keras callback to save model weights during training based on a specified metric.
- Attributes:
weights_folder (str): Path to the directory where weights files will be saved. save_weights_mode (str): Mode of saving weights, either ‘all’, ‘val_loss’, or any other metric name. save_weights_silent (bool, optional): If True, suppresses the print statements during weight saving. Defaults to False. base_val_metric (float): The base validation metric achieved so far during training. Initialized based on the provided metric.
- on_epoch_end(epoch, logs=None)
Called at the end of each epoch. Saves the model weights based on the provided mode.
- Args:
epoch (int): The current epoch number. logs (dict, optional): Dictionary of logs containing training and validation metrics. Defaults to None.