Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow validation after N training steps #461

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions everyvoice/.schema/everyvoice-aligner-schema-0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down
29 changes: 26 additions & 3 deletions everyvoice/.schema/everyvoice-spec-to-wav-schema-0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down
29 changes: 26 additions & 3 deletions everyvoice/.schema/everyvoice-text-to-spec-schema-0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down
116 changes: 104 additions & 12 deletions everyvoice/.schema/everyvoice-text-to-wav-schema-0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down Expand Up @@ -761,11 +784,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down Expand Up @@ -1092,11 +1138,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down Expand Up @@ -1630,11 +1699,34 @@
"description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
"title": "Ckpt Epochs"
},
"val_check_interval": {
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": 500,
"description": "How often to check the validation set. Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch. Pass an int to check after a fixed number of training batches.",
"title": "Val Check Interval"
},
"check_val_every_n_epoch": {
"default": 1,
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
"title": "Check Val Every N Epoch",
"type": "integer"
"title": "Check Val Every N Epoch"
},
"max_epochs": {
"default": 1000,
Expand Down
1 change: 1 addition & 0 deletions everyvoice/base_cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def train_base_command(
max_epochs=config.training.max_epochs,
max_steps=config.training.max_steps,
check_val_every_n_epoch=config.training.check_val_every_n_epoch,
val_check_interval=config.training.val_check_interval,
callbacks=[monitored_ckpt_callback, last_ckpt_callback, lr_monitor],
strategy=strategy,
num_nodes=nodes,
Expand Down
12 changes: 9 additions & 3 deletions everyvoice/config/shared_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ValidationInfo,
model_validator,
)
from typing_extensions import Annotated
from typing_extensions import Annotated, Optional

from everyvoice.config.utils import (
PossiblyRelativePath,
Expand Down Expand Up @@ -195,8 +195,14 @@ class BaseTrainingConfig(PartialLoadConfig):
1,
description="The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
)
check_val_every_n_epoch: int = Field(
1,
val_check_interval: Union[int, float, None] = Field(
500,
description="How often to check the validation set."
" Pass a float in the range [0.0, 1.0] to check after a fraction of the training epoch."
" Pass an int to check after a fixed number of training batches.",
)
check_val_every_n_epoch: Optional[int] = Field(
None,
description="Run validation after every n epochs. Defaults to 1, but if you have a small dataset you should change this to be larger to speed up training",
)
max_epochs: int = Field(1000, description="Stop training after this many epochs")
Expand Down