snorkel.classification.Checkpointer¶
-
class
snorkel.classification.
Checkpointer
(counter_unit, evaluation_freq, **kwargs)[source]¶ Bases:
object
Manager for checkpointing model.
- Parameters
counter_unit (
str
) – The unit to use when determining when its time to checkpoint (one of [“epochs”, “batches”, “points”]); must match the counter_unit of LogManagerevaluation_freq (
float
) – How frequently the model is being evaluated (this is the maximum frequency that checkpointing can occur, which will happen if checkpoint_factor==1)kwargs (
Any
) – Config merged withdefault_config["checkpointer_config"]
-
__init__
(counter_unit, evaluation_freq, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
- Return type
None
Methods
__init__
(counter_unit, evaluation_freq, **kwargs)Initialize self.
checkpoint
(iteration, model, metric_dict)Check if iteration and current metrics necessitate a checkpoint.
clear
()Clear existing checkpoint files, besides the best-yet model.
load_best_model
(model)Load the best model from the checkpoint.
-
checkpoint
(iteration, model, metric_dict)[source]¶ Check if iteration and current metrics necessitate a checkpoint.
- Parameters
iteration (
float
) – Current training iterationmodel (
MultitaskClassifier
) – Model to checkpointmetric_dict (
Dict
[str
,float
]) – Current performance metrics for model
- Return type
None