Skip to content

[DOC] inconsistent default value for val_check_intervalΒ #20678

@turbotimon

Description

@turbotimon

πŸ“š Documentation

Inconsistent default value for val_check_interval, where the Core API Documentation claims to be 1.0:

val_check_interval (Union[int, float, None]) – 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. An int value can only be higher than the number of training batches when check_val_every_n_epoch=None, which validates after every N training batches across epochs or during iteration-based training. Default: 1.0.

But the Trainer signature says None:

classlightning.pytorch.trainer.trainer.Trainer(*, accelerator='auto', strategy='auto', devices='auto', num_nodes=1, precision=None, logger=None, callbacks=None, fast_dev_run=False, max_epochs=None, min_epochs=None, max_steps=-1, min_steps=None, max_time=None, limit_train_batches=None, limit_val_batches=None, limit_test_batches=None, limit_predict_batches=None, overfit_batches=0.0, val_check_interval=None, check_val_every_n_epoch=1, num_sanity_val_steps=None, log_every_n_steps=None, enable_checkpointing=None, enable_progress_bar=None, enable_model_summary=None, accumulate_grad_batches=1, gradient_clip_val=None, gradient_clip_algorithm=None, deterministic=None, benchmark=None, inference_mode=True, use_distributed_sampler=True, profiler=None, detect_anomaly=False, barebones=False, plugins=None, sync_batchnorm=False, reload_dataloaders_every_n_epochs=0, default_root_dir=None, model_registry=None)

Even tough, further down the same page, it says again Default: 1.0. This seems to be very confusing in situation where I e.g. only want to check every 2 batches by settings check_val_every_n_epoch=2 because the val_check_interval would still be at its default value of 1.0 leading to confusion how often validation happens.

If I understand it correctly, when I explicitly set check_val_every_n_epoch=2 it would take precedence over the val_check_interval=1.0? Therefore, "Default: None" makes more sense (also, it's the Class signature).

Having the default 1.0 in case I set explicit check_val_every_n_epoch=None also makes no sense, since the docs say check_val_every_n_epoch: ... If None, validation will be done solely based on the number of training batches, requiring val_check_interval to be an integer value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation relatedneeds triageWaiting to be triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions