Skip to content

let lightning handle moving preds to cpu #2829

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

Merged
merged 5 commits into from
Jun 27, 2025

Conversation

dennisbader
Copy link
Collaborator

@dennisbader dennisbader commented Jun 23, 2025

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Fixes #2828.

Summary

  • Fixed an issue with TorchForecastingModel.predict() on Windows machines, where tensor movement from GPU to CPU was not synchronized.
    • Instead of moving to CPU in LightningModule.predict_step(), we let Lightning handle it under the hood.

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.18%. Comparing base (07e549d) to head (800545f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2829      +/-   ##
==========================================
- Coverage   95.19%   95.18%   -0.01%     
==========================================
  Files         145      145              
  Lines       15126    15124       -2     
==========================================
- Hits        14399    14396       -3     
- Misses        727      728       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dennisbader dennisbader marked this pull request as ready for review June 27, 2025 07:16
@dennisbader dennisbader requested a review from madtoinou as a code owner June 27, 2025 07:16
Copy link
Collaborator

@madtoinou madtoinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment, otherwise it looks good to me.

@dennisbader dennisbader merged commit dbdab3b into master Jun 27, 2025
9 checks passed
@dennisbader dennisbader deleted the fix/tensor_gpu_to_cpu_sync branch June 27, 2025 09:52
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.

[BUG]Model instability and NaN/High MAPE on CUDA (Windows) — Suggest explicit torch.cuda.synchronize() after .to('cpu')
2 participants