Skip to content

should_validate

allennlp.training.callbacks.should_validate

[SOURCE]


ShouldValidateCallback

@TrainerCallback.register("should_validate_callback")
class ShouldValidateCallback(TrainerCallback):
 | def __init__(
 |     self,
 |     serialization_dir: str,
 |     validation_start: Optional[int] = None,
 |     validation_interval: Optional[int] = None
 | ) -> None

A callback that you can pass to the GradientDescentTrainer to change the frequency of validation during training. If validation_start is not None, validation will not occur until validation_start epochs have elapsed. If validation_interval is not None, validation will run every validation_interval number of epochs epochs.

on_start

class ShouldValidateCallback(TrainerCallback):
 | ...
 | def on_start(
 |     self,
 |     trainer: "GradientDescentTrainer",
 |     is_primary: bool = True,
 |     **kwargs
 | ) -> None

on_epoch

class ShouldValidateCallback(TrainerCallback):
 | ...
 | def on_epoch(
 |     self,
 |     trainer: "GradientDescentTrainer",
 |     metrics: Dict[str, Any],
 |     epoch: int,
 |     is_primary: bool = True,
 |     **kwargs
 | ) -> None

on_end

class ShouldValidateCallback(TrainerCallback):
 | ...
 | def on_end(
 |     self,
 |     trainer: "GradientDescentTrainer",
 |     metrics: Dict[str, Any] = None,
 |     epoch: int = None,
 |     is_primary: bool = True,
 |     **kwargs
 | ) -> None