[Feature] Reuse Ulysses shard lengths across MiniMax-H3 blocks

Abierto
#15,132 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #15064 de @YaoleWu — cerrado sin fusionar

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, pytorch

Línea de trabajo

Read src/diffusers/models/attention_dispatch.py around the Q/K/V and output helpers, then trace the H3 block stack in src/diffusers/models/transformers/transformer_minimax_h3.py. Use the proposed attention_kwargs opt-in and the named CPU/Gloo test as starting points; verify per-call plan rebuilding, collective ordering, and unchanged default and token-refiner paths. The issue reports prior results for packed lengths 18 → 20 → 18, while CUDA/NCCL, compile, latency, and generation checks remain unvalidated; maintainer coordination on scope is pending.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

MiniMax-H3 keeps the same packed text/video/audio sequence throughout its transformer blocks. With Ulysses Anything, each attention call still gathers shard lengths separately for Q, K, V and the output exchange. This repeats metadata communication even though the layout is unchanged within that forward.

On main at aaf57d03, the Q/K/V helper calls gather_size_by_comm, as does the output helper. H3 then repeats attention across its block stack.

Could H3 share an immutable shard-length plan within one inference forward? The plan should be rebuilt on every call, preserve collective ordering on all ranks, and leave the default and token-refiner paths unchanged. It should not become a cache shared between requests.

The proposed opt-in in #15064 is:

with torch.inference_mode():
    output = model(**inputs, attention_kwargs={"reuse_ulysses_metadata": True})

The existing two-process CPU/Gloo checks for that implementation, recorded on base d42ebf9c, matched the default tiny-H3 outputs for packed lengths 18 → 20 → 18 while using fewer all-gathers. Uneven attention checks covered 9 → 10 → 9; inconsistent full layouts raised on both ranks, and the original parallel configuration stayed unchanged.

DIFFUSERS_TEST_DEVICE=cpu PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 OMP_NUM_THREADS=1 \
  python -m pytest tests/models/transformers/test_models_transformer_minimax_h3.py::TestMiniMaxH3SequencePlan -q

These are prior CPU/Gloo results for the proposed implementation, not a new run on current main. CUDA/NCCL, compile, isolated latency, full-checkpoint generation and output quality remain unvalidated; no speedup is claimed.

#14871/#14834 cover Ulysses Anything backward and metadata within an attention call. This request concerns reuse across H3 blocks. Would you prefer this scope in #15064 or an extension of that lower-level work? Maintainer coordination is pending. AI assistance was used to prepare the implementation and this proposal.

Lenguaje dominante
Python
Estrellas
35k
Forks
7.5k
Merge medio
2 d 22 h
PR fusionados (30 d)
58

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de huggingface/diffusers

Todos los issues de huggingface/diffusers

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.