PRX pipelines ignore the dict returned by callback_on_step_end

Aperta
#15,355 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Toraastrta ci sta già lavorando.

Dal 20/11/2026.

  • #15356 di @Toraastrta — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python, pytorch

Direzione di ricerca

Read pipeline_prx.py around line 806 and pipeline_prx_pixel.py around line 642, then inspect the callback tests in tests/pipelines/prx/test_pipeline_prx.py and test_pipeline_prx_pixel.py. The issue describes the expected change and the failing assertion; run pytest tests/pipelines/prx -k callback --runxfail to confirm it, then check that the tests pass after the callback outputs are applied. A linked pull request is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

PRXPipeline and PRXPixelPipeline call callback_on_step_end but throw away the dict it returns:

callback_on_step_end(self, i, t, callback_kwargs)

(pipeline_prx.py around line 806, pipeline_prx_pixel.py around line 642). So a callback that changes latents has no effect. Every other pipeline pops the returned keys back, e.g. latents = callback_outputs.pop("latents", latents).

The test suite already knows about this: tests/pipelines/prx/test_pipeline_prx.py and test_pipeline_prx_pixel.py mark test_callback_inputs with a strict xfail (CALLBACK_OUTPUTS_IGNORED), with the note that "whoever adds the pop-back will see it XPASS and can drop this marker".

I'd like to open a PR for this: assign the callback output and pop latents back in both pipelines (+4 lines), and remove the two xfail markers. I left prompt_embeds out on purpose: it's in _callback_tensor_inputs, but it isn't read inside the denoising loop after the cross-attention embeddings are built, so popping it would change nothing.

Reproduction

The existing test, with the xfail marker ignored:

pytest tests/pipelines/prx -k callback --runxfail

On main (4f78832):

FAILED tests/pipelines/prx/test_pipeline_prx.py::TestPRXPipeline::test_callback_inputs
FAILED tests/pipelines/prx/test_pipeline_prx_pixel.py::TestPRXPixelPipeline::test_callback_inputs
2 failed, 2 passed, 73 deselected

The failing assertion is assert output.abs().sum() == 0: the test's callback sets latents to zeros on the last step, but the output isn't zero because the edit is dropped.

With the fix, pytest tests/pipelines/prx gives 61 passed, 16 skipped.

I verified this with the tiny components from the test suite only; I didn't run the Photoroom/prx-512-t2i-sft checkpoint.

Logs

No response

System Info
  • 🤗 Diffusers version: 0.44.0.dev0 (main @ 4f78832)
  • Platform: macOS-26.6.2-arm64-arm-64bit
  • Python version: 3.12.16
  • PyTorch version (GPU?): 2.15.0 (False)
  • Huggingface_hub version: 2.4.0
  • Transformers version: 5.23.0
  • Accelerate version: 1.16.0
Who can help?

@DN6 @yiyixuxu

Lingua principale
Python
Stelle
35k
Fork
7.5k
Merge medio
2g 22h
PR unite (30g)
58

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di huggingface/diffusers

Tutte le issue di huggingface/diffusers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.