Skip to content

Warn on RF-DETR head reinit and fix distill-config and quant-docs drift - #628

Merged
EHxuban11 merged 2 commits into
devfrom
quant-campaign-fixes
Jul 19, 2026
Merged

EHxuban11 merged 2 commits into
devfrom
quant-campaign-fixes

Conversation

@EHxuban11

@EHxuban11 EHxuban11 commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Three small fixes from the 2026-07-19 quantization viability campaign:

  • RF-DETR training now warns loudly when a class-count change reinitializes the detection head: the pretrained head is discarded, so short fine-tunes underperform until the new head converges (measured ~9 mAP points at a 5-epoch budget even in fp32).
  • get_distill_config(family=...) now routes "rfdetr" to the model class, which already implemented get_distill_config(); the helper rejected it, and the unsupported-family unit test had fossilized that drift (now uses picodet as the unknown family).
  • Quantization docs: fp16 and bf16 casts both execute natively; the wording claimed fp16 only.

Tests: tests/unit/test_distillation*.py and test_rfdetr_lr_contract.py, 79 passed.

Code provenance

All changes in this PR are original, written for this PR against the existing LibreYOLO codebase. No code was ported, adapted, or derived from any third-party source.

…ll config, cast docs

- Warn loudly when RF-DETR training reinitializes the detection head on a
  class-count change: the pretrained head is discarded, so short
  fine-tunes underperform until the new head converges (measured ~9 mAP
  points at a 5-epoch budget even in fp32).
- Route family="rfdetr" through the distillation config helper: the model
  class has had get_distill_config() support while the helper still
  rejected it, and the unsupported-family test had fossilized that drift
  (now uses picodet as the unknown family).
- Quantization docs: fp16 and bf16 casts both execute natively; the
  execution-tier wording claimed fp16 only.

Claude-Session: https://claude.ai/code/session_018Bkjq2cuWtXkEB6xHcLoRH
@greptile-apps

greptile-apps Bot commented Jul 19, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR tightens RF-DETR distillation behavior and updates related training and quantization messaging. The main changes are:

  • RF-DETR is added to the distillation convenience config path.
  • RF-DETR distillation config probing now avoids loading pretrained weights.
  • RF-DETR detect-task size limits are documented for the helper.
  • The RF-DETR head-reinitialization warning is limited to the main process.
  • Quantization docs now describe both fp16 and bf16 casts as native execution.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
libreyolo/distillation/configs.py Adds RF-DETR support to the distillation helper using the no-weights model sentinel.
libreyolo/models/rfdetr/trainer.py Limits the head-reinitialization warning to the main process while keeping model updates on all processes.
docs/quantization.md Updates the native cast wording to include bf16 with fp16.
tests/unit/test_distillation.py Updates the unsupported-family test now that RF-DETR is supported.

Reviews (2): Last reviewed commit: "Address review: offline-safe rfdetr dist..." | Re-trigger Greptile

Comment thread libreyolo/distillation/configs.py Outdated
Comment thread libreyolo/distillation/configs.py
Comment thread libreyolo/models/rfdetr/trainer.py Outdated
… warning

- The rfdetr branch of get_distill_config now builds with the empty-dict
  no-weights sentinel: model_path=None resolves and downloads the default
  pretrained checkpoint, which broke the helper's lightweight offline
  contract. The shape probe only needs the architecture; the returned
  config is identical (verified under HF_HUB_OFFLINE=1).
- The head-reinit warning is gated on is_main_process() so a DDP run logs
  it once instead of once per rank, matching the file's existing idiom.
- Docstring notes that helper sizes are validated against the detect
  task; other tasks should call model.get_distill_config() directly.

Claude-Session: https://claude.ai/code/session_018Bkjq2cuWtXkEB6xHcLoRH
@EHxuban11
EHxuban11 merged commit c9667fb into dev Jul 19, 2026
12 checks passed
@EHxuban11
EHxuban11 deleted the quant-campaign-fixes branch September 26, 2026 15:36
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