Skip to content

refactor(training): remove unused learning_rate_dict multitask handling#5278

Merged
wanghan-iapcm merged 1 commit intodeepmodeling:masterfrom
OutisLi:pr/lrmul
Mar 3, 2026
Merged

refactor(training): remove unused learning_rate_dict multitask handling#5278
wanghan-iapcm merged 1 commit intodeepmodeling:masterfrom
OutisLi:pr/lrmul

Conversation

@OutisLi
Copy link
Collaborator

@OutisLi OutisLi commented Mar 2, 2026

Remove the unused learning_rate_dict configuration option that allowed per-task learning rate settings in multitask training. This simplifies the code by using a single learning_rate configuration for all tasks.

Changes:

  • Remove learning_rate_dict branch in loss initialization
  • Remove per-task lr_schedule dictionary creation
  • Remove isinstance(dict) check in training loop
  • Unify single-task and multi-task code paths

Both PyTorch and Paddle backends are updated consistently.

Summary by CodeRabbit

  • Refactor
    • Streamlined learning rate scheduling in multi-task training scenarios to ensure consistent initialization and computation of learning rates across all models.

Remove the unused learning_rate_dict configuration option that allowed
per-task learning rate settings in multitask training. This simplifies
the code by using a single learning_rate configuration for all tasks.

Changes:
- Remove learning_rate_dict branch in loss initialization
- Remove per-task lr_schedule dictionary creation
- Remove isinstance(dict) check in training loop
- Unify single-task and multi-task code paths

Both PyTorch and Paddle backends are updated consistently.
Copilot AI review requested due to automatic review settings March 2, 2026 02:55
@github-actions github-actions bot added the Python label Mar 2, 2026
@dosubot dosubot bot added the enhancement label Mar 2, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3db25a and 1269ed8.

📒 Files selected for processing (2)
  • deepmd/pd/train/training.py
  • deepmd/pt/train/training.py

📝 Walkthrough

Walkthrough

This PR simplifies multi-task learning rate handling in both PD and PT training modules by removing per-model learning rate dictionaries and conditional branching. Learning rate schedules are now consistently derived from a single config["learning_rate"] source with unified parameter extraction.

Changes

Cohort / File(s) Summary
Learning Rate Schedule Simplification
deepmd/pd/train/training.py, deepmd/pt/train/training.py
Removed per-model learning rate dictionaries and conditional branching logic for multi-task training. Learning rate schedules now always constructed from single config["learning_rate"] source; loss computation uses unified config["learning_rate"]["start_lr"] extraction; training step directly calls self.lr_schedule.value(_step_id) for current learning rate.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • chore: refactor training loop #4435: Refactors multi-task model selection and training step signature in the same files, related to this PR's multi-task learning rate simplification.

Suggested labels

Python

Suggested reviewers

  • njzjz
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: removing unused learning_rate_dict multitask handling, which aligns with the PR's core objective of simplifying training code by eliminating per-task learning rate configuration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the unused learning_rate_dict multi-task configuration path from the PyTorch and Paddle training backends, standardizing multi-task training to use a single global learning_rate schedule.

Changes:

  • Simplified multi-task loss initialization to always use learning_rate.start_lr.
  • Removed per-task learning-rate schedule construction and dict-based handling.
  • Unified the training-step learning-rate lookup to a single BaseLR schedule for both single- and multi-task modes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
deepmd/pt/train/training.py Drops learning_rate_dict branches and dict-based LR schedule usage in PT training/loss initialization and step loop.
deepmd/pd/train/training.py Mirrors the PT cleanup in the Paddle backend to consistently use a single LR schedule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.13%. Comparing base (f0a966b) to head (1269ed8).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5278      +/-   ##
==========================================
+ Coverage   81.94%   82.13%   +0.19%     
==========================================
  Files         750      753       +3     
  Lines       75456    75808     +352     
  Branches     3648     3649       +1     
==========================================
+ Hits        61831    62267     +436     
+ Misses      12457    12374      -83     
+ Partials     1168     1167       -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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Mar 3, 2026
Merged via the queue into deepmodeling:master with commit 41757f2 Mar 3, 2026
76 of 77 checks passed
@OutisLi OutisLi deleted the pr/lrmul branch March 8, 2026 04:33
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.

4 participants