[bugfix] Fix Dreamverse Modal compile warmup latency - #1394
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 PR merge requirementsWaiting for
This rule is failing.
|
There was a problem hiding this comment.
Code Review
This pull request enables VAE compilation, activates torch compilation and startup warmup in the Modal app configuration, and updates the Gemma text encoder compilation preparation. The text encoder update runs a small eager forward pass to stabilize the layer state and prevent recompilation. Feedback is provided regarding the extraction of pad_token_id in gemma.py, where a list or tuple value could lead to a TypeError when converted to an integer.
| token_id = getattr(model.config, "eos_token_id", None) | ||
| if isinstance(token_id, (list, tuple)): | ||
| token_id = token_id[0] if token_id else None | ||
| if token_id is None: | ||
| token_id = getattr(model.config, "pad_token_id", 0) | ||
| input_ids = torch.full( | ||
| (1, 1), | ||
| int(token_id or 0), |
There was a problem hiding this comment.
If pad_token_id in the model configuration is a list or tuple (which is common in some tokenizers/models), getattr(model.config, "pad_token_id", 0) will return a list/tuple. Passing this directly to int(token_id or 0) will raise a TypeError. We should apply the same list/tuple extraction logic to pad_token_id to ensure robustness.
| token_id = getattr(model.config, "eos_token_id", None) | |
| if isinstance(token_id, (list, tuple)): | |
| token_id = token_id[0] if token_id else None | |
| if token_id is None: | |
| token_id = getattr(model.config, "pad_token_id", 0) | |
| input_ids = torch.full( | |
| (1, 1), | |
| int(token_id or 0), | |
| token_id = getattr(model.config, "eos_token_id", None) | |
| if isinstance(token_id, (list, tuple)): | |
| token_id = token_id[0] if token_id else None | |
| if token_id is None: | |
| token_id = getattr(model.config, "pad_token_id", None) | |
| if isinstance(token_id, (list, tuple)): | |
| token_id = token_id[0] if token_id else None | |
| input_ids = torch.full( | |
| (1, 1), | |
| int(token_id if token_id is not None else 0), |
|
Hi @Davids048 — automated review from Gob, one of @SolitaryThinker's AI reviewers. Findings aren't all human-verified; ping @SolitaryThinker if anything looks off. TL;DRClean, well-scoped bugfix with a great root-cause comment in Verdict: approve-with-followup
FindingsS2-1 —
|
| README claim | Backed by code? |
|---|---|
DREAMVERSE_MAX_AUTOTUNE env var exists |
yes — config.py:167 |
| Modal wrapper defaults to compile without max-autotune | yes — modal_app.py:25 (S2-2 caveat for non-Modal callers) |
DREAMVERSE_MAX_AUTOTUNE=1 modal deploy … opts in |
yes — modal_app.py forwards from deployer shell |
min_containers=1 + max_containers=1 keeps one B200 warm |
yes — modal_app.py:42-43 |
| VAE compile is now enabled | yes — video_generation.py:285 vae_enabled=enable_compile |
— Gob (@SolitaryThinker's AI reviewer). Full review archived locally.
|
Hi @Davids048 — automated review from Gob, one of @SolitaryThinker's AI reviewers. Findings aren't all human-verified; ping @SolitaryThinker if anything looks off. TL;DRThe address commit fixes the Verdict: approve-with-followupSeverity tally
Prior findings status at eb23093
Still open
— Gob (@SolitaryThinker's AI reviewer). Full review archived locally. |
Summary
output_hidden_states=True, avoiding a second text-encoder compile caused by Transformers' hidden-state wrapper side effect.DREAMVERSE_IMAGE, startup warmup, and torch compile enabled so registry image deploys exercise the optimized path by default.Validation
python -m py_compile apps/dreamverse/dreamverse/video_generation.py apps/dreamverse/scripts/modal/modal_app.py fastvideo/models/encoders/gemma.pyghcr.io/davids048/dreamverse-ui:cuda12.9.1-sha-321d5112b-warmup-vaecompile