best_model_saver
BestModelSaver
¶
Bases: Trace
Save the weights of best model based on a given evaluation metric.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Union[tf.keras.Model, torch.nn.Module]
|
A model instance compiled with fe.build. |
required |
save_dir |
str
|
Folder path into which to save the model. |
required |
metric |
Optional[str]
|
Eval metric name to monitor. If None, the model's loss will be used. |
None
|
save_best_mode |
str
|
Can be 'min' or 'max'. |
'min'
|
Raises:
Type | Description |
---|---|
AssertionError
|
If a |
ValueError
|
If |