Show current learning rate in training progress bar - #809
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #809 +/- ##
======================================
Coverage 75% 75%
======================================
Files 91 91
Lines 6806 6817 +11
======================================
+ Hits 5079 5089 +10
- Misses 1727 1728 +1 🚀 New features to boost your workflow:
|
Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds live learning-rate visibility during fine-tuning by logging the optimizer LR as a Lightning metric so it can appear in the tqdm progress bar.
Changes:
- Log
train/lrfrom the optimizer’s param group duringRFDETRModule.training_stepwithprog_bar=True. - Add a unit test asserting
train/lris logged withprog_bar=True. - Require
train/lrto exist inmetrics.csvvia the metrics CSV integration test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/rfdetr/training/module.py |
Logs train/lr each training step for progress-bar visibility. |
tests/training/test_module.py |
Adds a unit test validating train/lr is logged to the progress bar. |
tests/training/test_metrics_csv.py |
Adds train/lr to the required metrics.csv columns set. |
Comments suppressed due to low confidence (1)
tests/training/test_metrics_csv.py:83
test_metrics_csv.pyis described as enforcing the metric columns thatplot_metrics()needs, butplot_metrics()currently only readstrain/loss,val/loss, andtest/loss(plusval/*AP/AR metrics). Addingtrain/lrhere makes the test intent/documentation inconsistent and creates extra coupling; either updateplot_metrics()to actually consume/plot LR, or keep this required-set limited to what the plotting code uses.
_REQUIRED_DETECTION = frozenset(
{
"train/loss",
"train/lr",
"val/loss",
"val/mAP_50",
"val/mAP_50_95",
"val/mAR",
}
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Updated `train/lr` logging to always set `on_step=True` and `on_epoch=False` in training module. - Added assertions in tests to validate these settings.
There was a problem hiding this comment.
Pull request overview
This PR adds visibility into the current learning rate during training by logging it to the Lightning progress bar (and ensuring it appears in metrics.csv), which helps users monitor scheduler behavior (warmup/decay/cosine) while fine-tuning.
Changes:
- Log the optimizer learning rate as
train/lrfromRFDETRModule.training_stepwithprog_bar=Trueand step-level logging. - Add a unit test asserting
train/lris logged with progress-bar visibility. - Extend the
metrics.csvintegration test required-column set to includetrain/lr.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/rfdetr/training/module.py |
Logs current LR as train/lr during training_step for progress-bar visibility. |
tests/training/test_module.py |
Adds a training-step unit test asserting train/lr is logged with prog_bar=True and step-only flags. |
tests/training/test_metrics_csv.py |
Requires train/lr to exist and have non-NaN values in metrics.csv. |
Comments suppressed due to low confidence (1)
tests/training/test_metrics_csv.py:83
_REQUIRED_DETECTIONis described as the set of columns thatplot_metrics()needs, butplot_metrics()currently only plots loss + val/* AP/AR metrics and does not usetrain/lr. Either update the test/module comments to reflect that this is an additional required metric beyond whatplot_metrics()consumes, or extendplot_metrics()to handle/plottrain/lrso the test intent matches the visualization behavior.
_REQUIRED_DETECTION = frozenset(
{
"train/loss",
"train/lr",
"val/loss",
"val/mAP_50",
"val/mAP_50_95",
"val/mAR",
}
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Added a real optimizer to tests for `param_groups` to ensure realistic "lr" key handling. - Mocked optimizer return to align with the updated test setup.
Users monitoring LR during fine-tuning had no visibility into the current learning rate from the tqdm progress bar — making it hard to observe warmup ramp-up, step decay, or cosine annealing in real time.
Changes
RFDETRModule.training_step: Reads the current LR fromoptimizer.param_groups[0]["lr"]after each step and logs it astrain/lrwithprog_bar=True, on_step=True, on_epoch=False. Works correctly for both step-decay and cosine schedulers.test_module.py: Addstest_logs_learning_rate_to_prog_bartoTestTrainingStepassertingtrain/lris logged withprog_bar=True.test_metrics_csv.py: Addstrain/lrto_REQUIRED_DETECTIONto ensure it's always present inmetrics.csv.The LR now appears alongside
train/lossin the progress bar:Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
pypi.nvidia.comif sys.path[0] == "":
sys.path.pop(0)
sys.path = [] + sys.path
import wheel_stub.buildapi as backend
wheel_filename = backend.build_wheel("/home/REDACTED/.cache/uv/builds-v0/.tmpt5WLug", {}, None)
with open("/home/REDACTED/.cache/uv/builds` (dns block)
if sys.path[0] == "":
sys.path.pop(0)
sys.path = [] + sys.path
import wheel_stub.buildapi as backend
wheel_filename = backend.build_wheel("/home/REDACTED/.cache/uv/builds-v0/.tmpmKS7yB", {}, None)
with open("/home/REDACTED/.cache/uv/builds` (dns block)
Original prompt
1.6.0rc: we need to see currentlearning_ratein progess bar #804🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.