Skip to content

Missing property 'allow_zero_length_dataloader_with_multiple_devices' of LightningDataModule #21358

@kopetri

Description

@kopetri

Bug description

In the recent version 2.5.6 the Trainer objects expects the LightningDataModule to have a property allow_zero_length_dataloader_with_multiple_devices. However, going through the code this property is missing.

What version are you seeing the problem on?

v2.5

Reproduced in studio

No response

How to reproduce the bug

trainer = L.Trainer()

lit = L.LightningModule()

dm = L.LightningDataModule()
 
trainer.validate(lit, datamodule=dm)

Error messages and logs

Traceback (most recent call last):
  File "/home/sebastian/projects/ldc_dataandai_pedestrian_detection/tools/eval.py", line 46, in <module>
    main(args)
  File "/home/sebastian/projects/ldc_dataandai_pedestrian_detection/tools/eval.py", line 31, in main
    trainer.validate(lit, datamodule=dm)
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py", line 663, in validate
    return call._call_and_handle_interrupt(
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py", line 49, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py", line 705, in _validate_impl
    results = self._run(model, ckpt_path=ckpt_path)
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py", line 1011, in _run
    results = self._run_stage()
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py", line 1048, in _run_stage
    return self._evaluation_loop.run()
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/loops/utilities.py", line 179, in _decorator
    return loop_run(self, *args, **kwargs)
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/loops/evaluation_loop.py", line 120, in run
    self.setup_data()
  File "/home/sebastian/.cache/pypoetry/virtualenvs/ldc-dataandai-pedestrian-detection--enVoRUD-py3.10/lib/python3.10/site-packages/lightning/pytorch/loops/evaluation_loop.py", line 197, in setup_data
    allow_zero_length |= trainer.datamodule.allow_zero_length_dataloader_with_multiple_devices
AttributeError: 'CocoDataModule' object has no attribute 'allow_zero_length_dataloader_with_multiple_devices'

Environment

Current environment
- PyTorch Lightning Version 2.5.6:
- PyTorch Version 2.9.0:
- Python version 3.10.13:
- ubuntu 24.04:
- How you installed Lightning (poetry):

More info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageWaiting to be triaged by maintainersver: 2.5.x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions