Skip to content

Use inference_mode for evaluation methods#18

Merged
JeremieGince merged 2 commits intodevfrom
fix_inference_mode
Feb 13, 2026
Merged

Use inference_mode for evaluation methods#18
JeremieGince merged 2 commits intodevfrom
fix_inference_mode

Conversation

@JeremieGince
Copy link
Contributor

@JeremieGince JeremieGince commented Feb 13, 2026

Description

Import torch.autograd.inference_mode and apply @inference_mode() to run_train_validation, run_validation, and run_test. This disables autograd during evaluation/metric gathering, reducing memory usage and overhead and improving runtime performance. The import was added near the other imports at the top of lightning_pipeline.py.


Checklist

Please complete the following checklist when submitting a PR. The PR will not be reviewed until all items are checked.

  • All new features include a unit test.
    Make sure that the tests passed and the coverage is
    sufficient by running pytest tests --cov=src --cov-report=term-missing.
  • All new functions and code are clearly documented.
  • The code is formatted using Black.
    You can do this by running black src tests.
  • The imports are sorted using isort.
    You can do this by running isort src tests.
  • The code is type-checked using Mypy.
    You can do this by running mypy src tests.

Import torch.autograd.inference_mode and apply @inference_mode() to run_train_validation, run_validation, and run_test. This disables autograd during evaluation/metric gathering, reducing memory usage and overhead and improving runtime performance. The import was added near the other imports at the top of lightning_pipeline.py.
Move the `from torch.autograd import inference_mode` import below the Lightning imports to fix import ordering and reduce the chance of import-time issues or linter complaints. No functional logic changed.
@github-actions
Copy link

github-actions bot commented Feb 13, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
901 875 97% 90% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/matchcake_opt/tr_pipeline/lightning_pipeline.py 96% 🟢
TOTAL 96% 🟢

updated for commit: 4f9df9f by action🐍

@JeremieGince JeremieGince merged commit 69809f7 into dev Feb 13, 2026
6 checks passed
@JeremieGince JeremieGince deleted the fix_inference_mode branch February 13, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant