[Python] trainer.val_dataloaders is None in the method `on_fit_start`

Discussão em 'Python' iniciado por Stack, Julho 4, 2025.

  1. Stack

    Stack Membro Participativo

    I am currently using pytorch-lightning to perform some deep learning tasks.
    The code is currently working fine. However, I wanted to perform some pre-training tasks (mostly vizualisation). I implemented theses tasks in the on_fit_start hook.
    Inside this hook, the val_dataloaders attribute from trainer is always None.
    Later on in the script (for instance in the on_fit_end hook, I call it exactly the same way, and it actually yields my dataloader).
    Is the dataloader not available at this stage of the fit ? I could not find anything ressembling elsewhere.

    When I commented the on_fit_start method, everything worked well even though the validation dataloader is still called the same way. I could refactor my code to do the preprocessing elsewhere, but it would not make sense from a logical point of view... Any idead what might be wrong ?

    Thanks in advance!

    Continue reading...

Compartilhe esta Página