Skip to content

Fix detector training with AMP enabled - #219

Open
sopenlaz0 wants to merge 1 commit into
Topdu:mainfrom
sopenlaz0:agent/fix-detector-amp-init
Open

Fix detector training with AMP enabled#219
sopenlaz0 wants to merge 1 commit into
Topdu:mainfrom
sopenlaz0:agent/fix-detector-amp-init

Conversation

@sopenlaz0

Copy link
Copy Markdown

What changed

Initialize Trainer.use_transformers to False in the detector model setup and add a focused detector-AMP training regression test.

Root cause

The AMP training branch checks self.use_transformers before choosing the model call signature. Recognition setup initializes that attribute, but detector setup did not, so detector training with Global.use_amp: true raised AttributeError before its first forward pass.

Detection models always use the standard model(image, data=...) path, so setting the flag to False in _init_det_model makes that contract explicit.

Validation

  • pytest -q tests/test_detector_amp.py — 1 passed
  • Structured Codex autoreview — clean, no actionable findings

The regression test initializes the detector builders and executes one AMP optimizer step through Trainer.train; it fails on the previous code at the undefined attribute and passes with this fix.

@sopenlaz0
sopenlaz0 marked this pull request as ready for review August 7, 2026 05:58
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