This repository was archived by the owner on Feb 21, 2026. It is now read-only.
Add gradient accumulation and AMP to training scaffold#8
Draft
Add gradient accumulation and AMP to training scaffold#8
Conversation
Co-authored-by: thinksyncs <42225585+thinksyncs@users.noreply.github.com>
Co-authored-by: thinksyncs <42225585+thinksyncs@users.noreply.github.com>
Co-authored-by: thinksyncs <42225585+thinksyncs@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add gradient clipping and accumulation with AMP
Add gradient accumulation and AMP to training scaffold
Feb 6, 2026
thinksyncs
approved these changes
Feb 6, 2026
Copilot AI
added a commit
that referenced
this pull request
Feb 6, 2026
Co-authored-by: thinksyncs <42225585+thinksyncs@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements gradient accumulation and automatic mixed precision (AMP) for the RT-DETR pose trainer. Gradient clipping already existed via
--clip-grad-norm.Changes
Gradient Accumulation (
--gradient-accumulation-steps N)if (steps + 1) % accum_steps == 0AMP (
--use-amp)torch.cuda.amp.GradScaleron CUDA devices, warns and disables on CPUautocast()contextscaler.unscale_(optim)→clip_grad_norm_()→scaler.step()Interaction
Usage
# Effective batch size 16 with AMP and clipping python rtdetr_pose/tools/train_minimal.py \ --device cuda:0 \ --batch-size 4 \ --gradient-accumulation-steps 4 \ --clip-grad-norm 1.0 \ --use-ampAll features are backward compatible (default disabled) and can be used independently.
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:
images.cocodataset.org/usr/bin/python3 python3 /home/REDACTED/work/YOLOZU/YOLOZU/tools/fetch_coco128_official.py --out /home/REDACTED/work/YOLOZU/YOLOZU/data/coco128 --insecure(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.