TCDScheduler advances the generator on the final step of a strength-truncated custom schedule
Los mantenedores suelen responder en 1 día
@SIDDARTHAREDDY8 ya está trabajando en esto.
Desde el 15/11/2026.
- #15301 de @SIDDARTHAREDDY8 — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- machine-learning
Línea de trabajo
Empieza en el método step de TCDScheduler, donde la comprobación del paso final compara el índice actual con num_inference_steps y luego muestrea ruido cuando eta > 0. Ejecuta el script de reproducción del issue, que usa set_timesteps(timesteps=[999, 499, 19], strength=0.5), y confirma que el estado del generador cambia. Está terminado cuando la comprobación usa la longitud de self.timesteps, el estado del generador no cambia en el paso final real y las pruebas existentes del scheduler TCD siguen pasando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When TCDScheduler uses a non-empty custom timestep schedule truncated by
strength < 1, its actual final step advances the supplied random generator
when eta > 0.
For example, timesteps=[999, 499, 19] with strength=0.5 leaves only [19],
but num_inference_steps remains 3. The final-step check uses the original
step count and enters the noise-sampling branch.
In the tested case, the terminal output stays the same because the noise
coefficient is zero, but the generator state changes. Subsequent draws using
the same generator therefore differ.
I expected the actual final step to leave the generator state unchanged,
consistent with the scheduler's comment that noise is not used on the final
timestep.
A possible fix is to decide whether another step exists using the length of
self.timesteps. I have tested a candidate fix and can provide it for review.
Reproduction
import diffusers
import torch
from diffusers import TCDScheduler
print(f"torch={torch.__version__} diffusers={diffusers.__version__}")
print(f"source={diffusers.__file__}")
scheduler = TCDScheduler(prediction_type="sample")
scheduler.set_timesteps(timesteps=[999, 499, 19], strength=0.5, device="cpu")
generator = torch.Generator(device="cpu").manual_seed(0)
control = torch.Generator(device="cpu").manual_seed(0)
sample = torch.ones((1, 1), device="cpu")
before = generator.get_state().clone()
result = scheduler.step(
torch.zeros_like(sample),
scheduler.timesteps[0],
sample,
eta=0.3,
generator=generator,
)
after = generator.get_state()
next_draw = torch.randn(4, generator=generator, device="cpu")
control_draw = torch.randn(4, generator=control, device="cpu")
print(f"actual timesteps={scheduler.timesteps.tolist()}")
print(f"num_inference_steps={scheduler.num_inference_steps}")
print(f"prev_sample={result.prev_sample.item()}")
print(f"pred_noised_sample={result.pred_noised_sample.item()}")
print(f"RNG state preserved: {torch.equal(before, after)}")
print(f"next draw: {next_draw.tolist()}")
print(f"control: {control_draw.tolist()}")
assert torch.equal(before, after), "The terminal step advanced the generator"
Context
No response
Logs
Baseline: unmodified Diffusers source at commit
43e30028af5120d8b0868cb6975b9fad39cc4fab
torch=2.9.0+cu126
diffusers=0.44.0.dev0
actual timesteps=[19]
num_inference_steps=3
prev_sample=0.21879726648330688
pred_noised_sample=0.21879726648330688
RNG state preserved: False
next draw: [-0.293428897857666, -2.1787893772125244, 0.5684312582015991, -1.0845223665237427]
control: [1.5409960746765137, -0.293428897857666, -2.1787893772125244, 0.5684312582015991]
AssertionError: The terminal step advanced the generator
System Info
Platform: Windows 11
Python: 3.12.8
PyTorch: 2.9.0+cu126
Diffusers: 0.44.0.dev0, source checkout at commit 43e30028af5120d8b0868cb6975b9fad39cc4fab
Device used for reproduction: CPU
Who can help?
No response
- Lenguaje dominante
- Python
- Estrellas
- 34.9k
- Forks
- 7.5k
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 65
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de huggingface/diffusers
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
huggingface/diffusers#15363 ·
Los mantenedores suelen responder en 1 día
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorPosiblemente ocupada @chessing234 la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
huggingface/diffusers#15337 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Multi-vector textual inversion uses only the first vector when the token has uppercase letters (transformers v5)Posiblemente ocupada @sunhouy la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
huggingface/diffusers#15313 ·
Los mantenedores suelen responder en 1 día
-
unload_textual_inversion(token) leaves the extra tokens of a multi-vector embedding behind, so it can't be loaded againPosiblemente ocupada @sohailshk la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
huggingface/diffusers#15211 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
set_ip_adapter_scale(float) raises "Cannot assign 1 scale_configs to 2 IP-Adapter" when several IP-Adapters are loadedPosiblemente ocupada @sohailshk la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
huggingface/diffusers#15210 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de huggingface/diffusers
Issues similares
-
[dbt] exported dataset keys reference physical columnsPosiblemente ocupada @WilliamKelley la tomó hoy. Abiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/ossie-converters#251 ·
Los mantenedores suelen responder en 2 días
-
cli difficulty: easy enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
desec-io/desec-stack#1312 ·
Los mantenedores suelen responder en 14 días
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws/aws-durable-execution-sdk-python#977 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
flashinfer-ai/flashinfer#9803 ·
Los mantenedores suelen responder en 1 día