Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Fabric trainer example to not call self.trainer.model during validation #19993

Merged
merged 6 commits into from
Jun 21, 2024

Commits on Jun 18, 2024

  1. Updated trainer to not call self.trainer.model during validation.

    Before, using the trainer 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. This change allows the model to be switched between train and eval mode (which the original behavior intends) without relying on calling 'self.trainer.model'. A check is added for overridden methods to not change a user's code.
    liambsmith committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    098a964 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2ba728f View commit details
    Browse the repository at this point in the history
  3. Fixed minor typo

    liambsmith committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    056be5d View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2024

  1. Changed validation eval/train to just call model.train() and model.ev…

    …al()
    
    Change to not overcomplicate the fix for fabric not working with the default "on_validation_model_eval" and "on_validation_model_train".
    liambsmith committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    1bc6ea2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f73dc83 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ebd2788 View commit details
    Browse the repository at this point in the history