Skip to content

The Lightning 2.0 Trainer issues length-zero DataLoader / CombinedLoader warning when num_sanity_val_steps=0 #17193

@mishooax

Description

@mishooax

Bug description

Hello, after upgrading to pytorch lightning 2.0 my trainer.fit started issuing the following warnings:

(...)pytorch_lightning/utilities/data.py:105: UserWarning: Total length of `CombinedLoader` across ranks is zero. Please make sure this was your intention.
  rank_zero_warn(
(...)pytorch_lightning/utilities/data.py:105: UserWarning: Total length of `DataLoader` across ranks is zero. Please make sure this was your intention.
  rank_zero_warn(

This is a single-gpu run with strategy="auto", devices=1, accelerator="gpu" and num_sanity_val_steps=0. I suspect the removal of the validation sanity check may be leading to this warning? My val_dataloader definitely has length >> 1 (I am waiting for the validation epoch to run through at this very moment...)

How to reproduce the bug

No response

Error messages and logs

# Error messages and logs here please
(...)pytorch_lightning/utilities/data.py:105: UserWarning: Total length of `CombinedLoader` across ranks is zero. Please make sure this was your intention.
  rank_zero_warn(
(...)pytorch_lightning/utilities/data.py:105: UserWarning: Total length of `DataLoader` across ranks is zero. Please make sure this was your intention.
  rank_zero_warn(

Environment

Current environment
#- Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow): Trainer
#- PyTorch Lightning Version (e.g., 1.5.0): 2.0
#- Lightning App Version (e.g., 0.5.2): n/a
#- PyTorch Version (e.g., 2.0): 2.0
#- Python version (e.g., 3.9): 3.9
#- OS (e.g., Linux): Linux
#- CUDA/cuDNN version: 11.8
#- GPU models and configuration: A100
#- How you installed Lightning(`conda`, `pip`, source): conda
#- Running environment of LightningApp (e.g. local, cloud): n/a

More info

No response

cc @justusschock @awaelchli

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdata handlingGeneric data-related topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions