Repository navigation
Let a recipe train at the precision its upstream reference uses - #10
Merged
Merged
Conversation
RF100-VL forced every family to fp32. For EdgeCrafter that matches neither the reference implementation, which sets use_amp with a GradScaler in ecdetseg/configs/ecdet/ecdet.yml, nor LibreYOLO's ECConfig, which enables amp and inherits the float16 dtype. Training a model at a precision nobody who built it uses is its own distortion, so allow fp16 and record what ran. - Derive amp and amp_dtype from one PRECISION_AMP_DTYPE table. They were computed as `precision == "bfloat16"` and the literal `"bfloat16"`, so an fp16 recipe would have silently trained in fp32 while its stats and submission claimed fp16. - Accept fp16 in both gates. The recipe validator rejected it outright, and the evaluation path separately flagged it as mismatched training metadata, which would have invalidated the submission after a successful campaign. - Record the precision. Nothing in a submission said which one produced it: `config` omits it and `runtime.precision` is the assemble_result default, never passed by the RF100-VL path. `rf100vl.training_precision` now carries it, read from the per-dataset stats, and disagreement across checkpoints becomes an invalid_reason rather than passing unnoticed. - Set the ec recipe to fp16 and pin the intent in tests: an allowlist names every family that is deliberately not fp32, so the next one has to justify itself instead of drifting. LibreYOLO enables the GradScaler for fp16 and skips it for bf16 (trainer.py:1599), so fp16 gets the loss scaling it needs.
This was referenced Aug 10, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
RF100-VL forced every family to fp32. For EdgeCrafter that matches neither its
authors nor our own library, so the ec recipe now runs fp16, and the harness
records which precision produced a result.
Why ec is fp16
ecdetseg/configs/ecdet/ecdet.ymlsetsuse_amp: Truewith aGradScaler, and the train loop wraps the forward intorch.autocastwithno dtype, which is fp16 on CUDA. All four size configs
__include__it, sofine-tuning inherits it too.
ECConfigsetsamp: bool = Trueand overrides noamp_dtype, so it inherits the base"float16".(
trainer.py:1599), so fp16 gets the loss scaling it needs.Three bugs this also fixes
amp_dtype ignored the recipe. It was
"amp": precision == "bfloat16"witha hardcoded
"amp_dtype": "bfloat16", so an fp16 recipe would have trained infp32 while its stats and submission claimed fp16. Both now come from one
PRECISION_AMP_DTYPEtable.Two separate gates rejected fp16.
load_reciperefused it, and_recipe_reproindependently flagged it as mismatched training metadata,which would have invalidated a submission after a campaign had already run.
No submission recorded its precision.
configomits it andruntime.precisionisassemble_result's default, never passed by theRF100-VL path, so every published run says fp32 whatever it did. There is now
rf100vl.training_precision, read from the per-dataset stats, and checkpointsthat disagree produce an
invalid_reasoninstead of passing unnoticed.Tests
162 passed. New coverage: the dtype table across all three precisions
(the regression above), the ec recipe pinned to fp16, and the existing
all-families check turned into an allowlist so a new family cannot pick a
non-fp32 precision without naming a reason.
Code provenance
Original code written for this PR by me, an AI agent. Precision facts were
read from two sources and are cited above: the EdgeCrafter reference
implementation at
Intellindust-AI-Lab/EdgeCrafter(Apache-2.0), inspectedonly to determine what precision it trains at, with no code copied or adapted;
and LibreYOLO's own
training/config.pyandtraining/trainer.py.Unrelated finding while tracing that:
THIRD_PARTY_NOTICES.txtin thelibreyolo repo attributes EdgeCrafter to
github.com/EC-codehub/EdgeCrafter,which 404s. The live repo appears to be
Intellindust-AI-Lab/EdgeCrafter.Worth correcting there, separately from this PR.