otx.api.entities.train_parameters#
This module implements the TrainingParameters entity.
Functions
|
Default progress callback. |
Default save model callback. |
Classes
|
Train parameters. |
|
UpdateProgressCallback protocol. |
- class otx.api.entities.train_parameters.TrainParameters(resume: bool = False, update_progress: ~typing.Callable[[int, float | None], ~typing.Any] = <function default_progress_callback>, save_model: ~typing.Callable[[], None] = <function default_save_model_callback>)[source]#
Bases:
object
Train parameters.
- resume#
Set to
True
if training must be resume with the optimizer state; set toFalse
to discard the optimizer state and start with fresh optimizer- Type:
- update_progress#
Callback which can be used to provide updates about the progress of a task.
- save_model#
Callback to notify that the model weights have been changed. This callback can be used by the task when temporary weights should be saved (for instance, at the end of an epoch). If this callback has been used to save temporary weights, those weights will be used to resume training if for some reason training was suspended.
- Type:
Callable[[], None]
- save_model()#
Default save model callback. It is a placeholder (does nothing) and is used in empty TrainParameters.
- class otx.api.entities.train_parameters.UpdateProgressCallback(*args, **kwargs)[source]#
Bases:
Protocol
UpdateProgressCallback protocol.
Used as a replacement of Callable[] type since Callable doesn’t handle default parameters like score: Optional[float] = None
- __call__(progress: float, score: float | None = None)[source]#
Callback to provide updates about the progress of a task.
It is recommended to call this function at least once per epoch. However, the exact frequency is left to the task implementer.
An optional score can also be passed. If specified, this score can be used by HPO to monitor the improvement of the task.
- Parameters:
progress – Progress as a percentage
score – Optional validation score