Lightning-AI / pytorch-lightning

Pretrain, finetune ANY AI model of ANY size on multiple GPUs, TPUs with zero code changes.

Home Page:https://lightning.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fabric example trainer fails with validation

liambsmith opened this issue · comments

Bug description

Using the example fabric trainer with validation would result in:

AttributeError: Your LightningModule code tried to access self.trainer.model but this attribute is not available when using Fabric with a LightningModule.

Which would occur during validation when 'on_validation_model_eval' and 'on_validation_model_train' were called, as they do not work with fabric.

What version are you seeing the problem on?

master

How to reproduce the bug

No response

Error messages and logs

# AttributeError: Your LightningModule code tried to access `self.trainer.model` but this attribute is not available when using Fabric with a LightningModule.

Environment

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

More info

No response