Skip to content

API consistency: "val" vs "validation" #6094

@msegado

Description

@msegado

Motivation

As a new user learning PyTorch Lightning, I was surprised at the naming inconsistency between the validation_step() and val_dataloader() hooks. Searching through the codebase, it seems that most methods or getters/setters favor "validation"...

  • validation_step_end
  • validation_step
  • validation_epoch_end
  • on_validation_start
  • on_validation_model_train
  • on_validation_model_eval
  • on_validation_epoch_start
  • on_validation_epoch_end
  • on_validation_end
  • on_validation_batch_start
  • on_validation_batch_end
  • init_validation_tqdm
  • enable_validation
  • disable_validation
  • _on_validation_start_log
  • _on_validation_epoch_start_log
  • _on_validation_epoch_end_log
  • _on_validation_end_log
  • _on_validation_batch_start_log
  • _on_validation_batch_end_log

...while a handful use "val" instead:

  • val_transforms
  • val_step_context
  • val_dataloader
  • val_batch_idx
  • total_val_batches
  • should_check_val_fx
  • reset_val_dataloader
  • reset_train_val_dataloaders
  • num_seen_val_check_batches

I wasn't able to see any obvious pattern in which methods got which naming convention, and think having a consistent convention throughout would make for a (slightly) cleaner and easier-to-learn library.

Related: #634

Pitch

Standardize all validation-related methods (and properties, if any exist) to use the same naming convention; either "val" (for consistency with e.g. torchvision) or "validation" (for consistency with the bulk of the current Lightning API). Renamed methods would be marked as deprecated and removed in the next major version bump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecationIncludes a deprecationdesignIncludes a design discussionfeatureIs an improvement or enhancementrefactor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions