Skip to content

Remove expired non_ema_revision deprecation blocks from training examples - #15118

Merged
sayakpaul merged 1 commit into
huggingface:mainfrom
A-Raphie:fix/examples-expired-non-ema-deprecation
Oct 24, 2026
Merged

sayakpaul merged 1 commit into
huggingface:mainfrom
A-Raphie:fix/examples-expired-non-ema-deprecation

Conversation

@A-Raphie

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #15115. Every training example that owns a --non_ema_revision argument still calls deprecate("non_ema_revision!=None", "0.15.0", message=...), but the helper's removal-past-version guard (src/diffusers/utils/deprecation_utils.py) now raises on any version ≥ 0.15.0. Since the parser defaults non_ema_revision to revision, simply passing the ordinary --revision=main reaches the block and crashes before model loading:

TypeError: deprecate() got an unexpected keyword argument 'message'

This removes the six expired blocks (and their now-unused deprecate imports) from:

  • examples/text_to_image/train_text_to_image.py
  • examples/instruct_pix2pix/train_instruct_pix2pix.py
  • examples/instruct_pix2pix/train_instruct_pix2pix_sdxl.py
  • examples/research_projects/instructpix2pix_lora/train_instruct_pix2pix_lora.py
  • examples/research_projects/onnxruntime/text_to_image/train_text_to_image.py
  • examples/research_projects/scheduled_huber_loss_training/text_to_image/train_text_to_image.py

Nothing else changes: parsers, revision handling, and loading calls are untouched, so the deprecation itself (already past its removal version) is simply enforced rather than crashing the scripts that pin it.

Fixes #15115

Who can review?

Training examples: @sayakpaul @linoytsaban

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case. → Training examples crash on --revision in expired non-EMA deprecation blocks #15115 (the issue proposes exactly this scope and asks whether such a patch is appropriate)
  • Did you make sure to update the documentation with your changes? → N/A (removed dead code only)
  • Did you write any new necessary tests? → The issue reporter's existing tiny-model training cases cover it; a live run is included below.
  • Are you the author (or part of the team) of the model/pipeline? → N/A

Self-review notes

Self-reviewed the full diff against the rubric. Findings fixed during review: the instructpix2pix_lora script imported deprecate alongside other names — the unused import is dropped too, keeping the import list honest. What I intentionally did not do: no behavioral guard replacing the removed block (the deprecation is long past its removal version; a warning there would be new behavior outside this issue's scope), and no changes to the SDXL/research scripts beyond the same block removal (their revision-loading paths are otherwise untouched and untested here).

Verification

Live run of the issue's exact repro flow on this branch (tiny SD checkpoint, CPU, 2 steps, --revision=main):

Steps: 100%|██████████| 2/2 [00:02<00:00, lr=0.0005, step_loss=0.994]
Model weights saved in .../unet/diffusion_pytorch_model.safetensors

On the unpatched tree the same command dies at startup with TypeError: deprecate() got an unexpected keyword argument 'message' — the reported crash. All six edited scripts compile (py_compile).

…ples

The deprecate('non_ema_revision!=None', '0.15.0', ...) call expired: the
deprecation helper now raises on any removal-past version, so the plain
--revision=main flow (parser defaults non_ema_revision to revision)
crashes with TypeError: deprecate() got an unexpected keyword argument
'message' before model loading. Drop the six expired blocks and their
unused imports. Verified: the text-to-image example trains end to end
with --revision=main on the tiny SD checkpoint after this change.
@github-actions github-actions Bot added examples fixes-issue size/M PR with diff < 200 LOC labels Oct 23, 2026

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sayakpaul
sayakpaul merged commit aaf57d0 into huggingface:main Oct 24, 2026
27 checks passed
mingyi456 added a commit to mingyi456/diffusers that referenced this pull request Oct 24, 2026
…/mingyi456/diffusers into animatextconditioner-single-file

* 'animatextconditioner-single-file' of https://github.com/mingyi456/diffusers: (50 commits)
  Remove expired non_ema_revision deprecation blocks from training examples (huggingface#15118)
  Remove duplicated converter and fix import order
  Update src/diffusers/loaders/single_file_utils.py
  add fibo-2 LoRA training and loading (huggingface#15084)
  [ci] fix compilation CI. (huggingface#15092)
  [LoRA] apply .alpha to Qwen-Image lora_A/lora_B LoRAs (huggingface#15016)
  Use HF Trusted Publisher token in update_metadata workflow (huggingface#15096)
  [ci] skip bf16 precision test on T4. (huggingface#15091)
  [LTX-2] Add `motion_speed` to condition the positional time base apart from the playback frame rate (huggingface#14967)
  [ci] fix misnamed test steps in push_tests.yml (huggingface#15094)
  [ci] use python 3.11 when using metadata. (huggingface#15093)
  Fix model imports when torchao is older than 0.15 (huggingface#15095)
  [tests] xfail some kandinsky6 tests (huggingface#14977)
  Add RFD4-Proteina (huggingface#15088)
  Add Bria fibo-2 (huggingface#14991)
  Fix PyArrow compatibility in CPU CI (huggingface#15082)
  [feat] add KVAE-Audio autoencoder (huggingface#14384)
  move unpack out of the flux, krea2 and ltx decoders into the core denoise groups (huggingface#14737)
  post-release 0.41.0 (huggingface#15062)
  FLUX.3: match the released BFL reference image sizing (huggingface#15073)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples fixes-issue size/M PR with diff < 200 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Training examples crash on --revision in expired non-EMA deprecation blocks

3 participants