fruit_project.utils.early_stop¶
Classes¶
Module Contents¶
- class fruit_project.utils.early_stop.EarlyStopping(patience: int, delta: float, path: str, name: str, cfg: omegaconf.DictConfig, run: wandb.sdk.wandb_run.Run)[source]¶
-
- __call__(val_metric: float, model: torch.nn.Module) bool [source]¶
Checks if early stopping criteria are met and saves the model if the metric improves.
- Parameters:
val_metric (float) – Validation metric to monitor.
model (nn.Module) – PyTorch model to save.
- Returns:
True if early stopping criteria are met, False otherwise.
- Return type:
bool