$ the-wire · showcase
Silent training bugs get loud: TRL raises on Flash Attention mask loss
By RepoJournal · Filed · About Hugging Face · Composed from the cited sources · methodology
TRL turned a silent Gemma3-family correctness bug into a hard error and made assistant-only loss actually assistant-only for Laguna, while speech-to-speech and transformers cleaned up failure and memory paths.
Raise in trainers when Flash Attention would drop the image attention mask of Gemma3-like VLMs huggingface/trl
Trainers now raise when training Gemma3, Gemma4, PaliGemma or Molmo2 on images with Flash Attention on transformers older than 5.24.0, because Flash Attention drops the bidirectional mask over image tokens and those tokens were being trained with causal attention instead, unlike at inference with SDPA or eager.
Support assistant-only loss for the Laguna chat templates huggingface/trl
TRL stored four Laguna chat templates with dedicated training variants because the shipped templates open their `{% generation %}` markers before `<assistant>`, so assistant-only loss was training the generation prompt (`<assistant>\n</think>` or `<assistant><think>`) along with the reply.
Make whole word masking linear in sequence length (#51394) huggingface/transformers
Whole word masking in the tokenizer replaced its pairwise same-word table with a word-id lookup, cutting the cost from quadratic to linear in sequence length while the tokenizer release notes say "Output is unchanged; memory drops from O(L^2) to O(L) per row." A test compares the new path against the old pairwise logic on random inputs.
Drop buffered partial output on mid-stream Transformers failure huggingface/speech-to-speech
When `generate()` raises mid-stream, the handler now discards unfinalized tokens in the streamer cache and skips the end-of-stream sentence batch flush, so buffered sentences and trailing partial words are no longer pushed to downstream output or TTS right before the turn fails under the default `stream_batch_sentences=3`.
Enable input gradients for PEFT with reentrant gradient checkpointing on all transformers versions huggingface/trl
Trainers now call `enable_input_require_grads()` for PEFT models with reentrant gradient checkpointing on every transformers version rather than only before 5.0.0, so that combination keeps training once transformers stops enabling input gradients itself.
Fix per-layer SwiGLU clipping in BailingHybrid huggingface/transformers
Also worth a look: BailingHybrid now applies the per-layer SwiGLU limits from the published Ling checkpoint configs to routed and shared experts independently, and HY4 RoPE switches to interleaved rotation to match the released checkpoint layout for MLA attention and the DSA indexer.
Action items
- → Upgrade transformers to 5.24.0 or later before training Gemma3, Gemma4, PaliGemma or Molmo2 on images with Flash Atte... huggingface/transformers [plan]