Flux and LTX pipelines do not forward the generator to stochastic scheduler steps
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- machine-learning
Línea de trabajo
Lee las clases FluxPipeline y LTXPipeline para encontrar dónde se llama a scheduler.step() sin el generator. Reenvía el generator de la pipeline a esa llamada, reflejando el PR #13678. Ejecuta el script de reproducción del issue: con stochastic_sampling=True, la diferencia máxima debería ser 0.000000.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
With FlowMatchEulerDiscreteScheduler(stochastic_sampling=True), FluxPipeline and LTXPipeline produce different outputs with the same supplied generator seed when unrelated global RNG state changes.
The pipelines use the supplied generator for initial latents but omit it from scheduler.step(). Subsequent noise therefore uses the global RNG.
PR #13678 fixed generator handling inside the scheduler; the pipeline callers still need to forward it.
I’d be happy to submit a PR to fix the issue.
Reproduction
This CPU example uses small real Flux components and precomputed prompt embeddings. Both calls use generator seed 17; only the global RNG state changes.
import torch
from diffusers import (
AutoencoderKL, FlowMatchEulerDiscreteScheduler,
FluxPipeline, FluxTransformer2DModel,
)
torch.set_num_threads(1)
torch.manual_seed(0)
transformer = FluxTransformer2DModel(
patch_size=1, in_channels=4, num_layers=1, num_single_layers=1,
attention_head_dim=16, num_attention_heads=2, joint_attention_dim=32,
pooled_projection_dim=32, axes_dims_rope=[4, 4, 8],
).eval()
vae = AutoencoderKL(
sample_size=32, in_channels=3, out_channels=3, block_out_channels=(4,),
layers_per_block=1, latent_channels=1, norm_num_groups=1,
use_quant_conv=False, use_post_quant_conv=False,
shift_factor=0.0609, scaling_factor=1.5035,
).eval()
pipe = FluxPipeline(
transformer=transformer, vae=vae,
scheduler=FlowMatchEulerDiscreteScheduler(),
text_encoder=None, tokenizer=None,
text_encoder_2=None, tokenizer_2=None,
)
pipe.set_progress_bar_config(disable=True)
prompt_embeds = torch.randn(1, 16, 32)
pooled_prompt_embeds = torch.randn(1, 32)
for stochastic in (False, True):
pipe.scheduler = FlowMatchEulerDiscreteScheduler(
stochastic_sampling=stochastic
)
outputs = []
for global_seed in (13, 99):
torch.manual_seed(global_seed)
outputs.append(pipe(
prompt_embeds=prompt_embeds,
pooled_prompt_embeds=pooled_prompt_embeds,
height=8, width=8, guidance_scale=1.0,
num_inference_steps=4,
generator=torch.Generator().manual_seed(17),
output_type="latent",
).images)
difference = (outputs[0] - outputs[1]).abs().max().item()
print(f"stochastic_sampling={stochastic}: max difference = {difference:.6f}")
The two runs should produce identical outputs with the same supplied generator seed, but in this example, they differ by up to 2.285045 when only the global RNG state changes.
Logs
stochastic_sampling=False: max difference = 0.000000
stochastic_sampling=True: max difference = 2.285045
System Info
- Diffusers:
0.42.1; also reproduced on main revision86ef420b17363c28e36ebad6b58555e9aa8feda2 - Python:
3.12.14 - PyTorch:
2.14.1 - Transformers:
5.20.2 - Platform: macOS arm64, CPU float32
Who can help?
No response
- Lenguaje dominante
- Python
- Estrellas
- 34.8k
- Forks
- 7.4k
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 58
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
-
Clarify set_adapters() adapter_weights documentation and type hintsPosiblemente ocupada @gorkadabo1 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
huggingface/diffusers#15146 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
huggingface/diffusers#15125 ·
Los mantenedores suelen responder en 1 día
-
`encode_video` truncates a fractional `fps`, so the video runs longer than its audioPosiblemente ocupada @guptaishaan la tomó hace 10 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
huggingface/diffusers#15104 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
VaeImageProcessor.denormalize() raises AttributeError for NumPy inputsPosiblemente ocupada @tonycoder-hub la tomó hace 20 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
huggingface/diffusers#15011 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`ModelMixin.from_pretrained` on a sharded checkpoint fails under `HF_HUB_OFFLINE=1` even when fully cached (`_get_checkpoint_shard_files` still calls `model_info`)Posiblemente ocupada @Subodh-17 la tomó hace 26 días. Abiertobug models
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
huggingface/diffusers#14952 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de huggingface/diffusers
Issues similares
-
good first issue test
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
ANCORATE/EncryptHome#8 ·
-
PluginProvider.storeInstance races and clobbers the dedup cache for concurrent loadsPosiblemente ocupada @Wilson0511 la tomó hoy. Abiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
Bug: failed Together chat calls do not record operation duration or error.typePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
community documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100