[MiniMax-H3] Block-level group offloading of the Qwen3-VL text encoder fails: the encoder step bypasses its top-level forward
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 18/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- ai-infra-agents
Rechercherichtung
Start with get_qwen3vl_prompt_embeds in the MiniMax-H3 and Pika-H3-Flex pipeline modules, where text_encoder.model(...) and the manual _hf_hook.pre_forward call bypass the top-level forward. Reproduce with block_level group offloading on the text encoder to see the device mismatch on the token embedding. Done means encoding succeeds under block_level offloading and matches the existing output; the linked pull request #15395 already proposes the change, so this is not open for a fresh attempt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
get_qwen3vl_prompt_embeds (MiniMax-H3, MiniMax-H3-Image, and its copy in Pika-H3-Flex) calls text_encoder.model(...) and fires accelerate's _hf_hook.pre_forward by hand; the code carries a TODO about it. Hooks that wrap only the top-level forward therefore never fire. With offload_type="block_level" group offloading on the text encoder, the modules outside the decoder blocks (the token embedding) are never onloaded and encoding fails:
RuntimeError: Expected all tensors to be on the same device, but got index is on cuda:0, different from other tensors on cpu
Reproduction
import torch
from diffusers import ModularPipeline
from diffusers.hooks import apply_group_offloading
pipe = ModularPipeline.from_pretrained("<MiniMax-H3-Image diffusers checkpoint>")
pipe.load_components(dtype=torch.bfloat16)
dev = torch.device("cuda")
pipe.transformer.enable_group_offload(dev, offload_device=torch.device("cpu"), offload_type="block_level", num_blocks_per_group=1, use_stream=True)
apply_group_offloading(pipe.text_encoder, dev, offload_device=torch.device("cpu"), offload_type="block_level", num_blocks_per_group=1, use_stream=True)
pipe.vae.to(dev)
pipe(prompt="a garden", height=1024, width=1024, output="images") # fails in the text encoder step
leaf_level on the text encoder works, because it hooks every leaf module.
Context
Offloading is the only way to run MiniMax-H3-Image on one 32 GB GPU: the documented ComponentsManager auto offload moves the ~62 GB text encoder as a whole and does not fit.
System Info
diffusers main (e3f8451), torch 2.14 (ROCm 10.1), Radeon AI PRO R9600D / R9700 (gfx1201).
Fix
#15395 calls text_encoder(...) with logits_to_keep=1 instead, so the top-level hooks fire; hidden_states[50] is bitwise identical to the current call.
- Vorherrschende Sprache
- Python
- Sterne
- 35k
- Forks
- 7.5k
- Ø Merge
- 2 T. 22 Std.
- Gemergte PRs (30 T.)
- 58
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus huggingface/diffusers
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
huggingface/diffusers#15436 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
InpaintProcessor crashes when padding_mask_crop is set and a dimension is omittedEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
huggingface/diffusers#15433 ·
Maintainer antworten meist innerhalb von 1 Tag
-
LTXEulerAncestralRFScheduler skips signal scaling with s_noise=0Evtl. vergeben @hparik11 hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
huggingface/diffusers#15423 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Docs: 13 docstrings document parameters their functions don't haveEvtl. vergeben @M-Colley hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
huggingface/diffusers#15363 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorEvtl. vergeben @chessing234 hat das vor 11 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
huggingface/diffusers#15337 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in huggingface/diffusers
Ähnliche Issues
-
[19.0] pos_sale: settling an order with a 0 down payment line crashes (reading 'reward_id') and leaves a wrong amount dueEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 79/100
developmentseed/titiler-covjson#164 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
awslabs/visual-asset-management-system#2164 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
MakazhanAlpamys/Soup#3589 ·
Maintainer antworten meist innerhalb von 1 Tag
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
Maintainer antworten meist innerhalb von 1 Tag