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

Refactor Lightning's trainer.model to trainer.lightning_module #2255

Conversation

samet-akcay
Copy link
Contributor

📝 Description

The trainer.model attribute is deprecated in newer versions of PyTorch Lightning. Using trainer.lightning_module is the recommended approach for accessing the LightningModule instance, which encapsulates our model, training logic, and related components.

  • This pull request updates our codebase to align with the latest best practices in PyTorch Lightning by replacing all instances of trainer.model with trainer.lightning_module.

✨ Changes

Replaced all occurrences of trainer.model with trainer.lightning_module

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🔨 Refactor (non-breaking change which refactors the code base)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Security update

✅ Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • 📋 I have summarized my changes in the CHANGELOG and followed the guidelines for my type of change (skip for minor changes, documentation updates, and test enhancements).
  • 📚 I have made the necessary updates to the documentation (if applicable).
  • 🧪 I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).

For more information about code review checklists, see the Code Review Checklist.

@samet-akcay samet-akcay changed the title Refactor trainer.model to trainer.lightning_module Refactor Lightning's trainer.model to trainer.lightning_module Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.82%. Comparing base (2bd2842) to head (e925153).
Report is 1 commits behind head on main.

Files Patch % Lines
src/anomalib/engine/engine.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2255      +/-   ##
==========================================
- Coverage   80.90%   80.82%   -0.08%     
==========================================
  Files         248      248              
  Lines       10859    10859              
==========================================
- Hits         8785     8777       -8     
- Misses       2074     2082       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@samet-akcay samet-akcay merged commit cfd3d8e into openvinotoolkit:main Aug 20, 2024
6 of 7 checks passed
@samet-akcay samet-akcay deleted the refactor/trainer-model-to-lightning-module branch August 20, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants