[feat]: Activate MagiHuman pipeline (registry + examples + SSIM) (8/8) - #1302
[feat]: Activate MagiHuman pipeline (registry + examples + SSIM) (8/8)#1302SolitaryThinker wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates the MagiHuman model family into the FastVideo framework by registering several variants (Base, Distill, SR-540p, and SR-1080p) for text-to-AV and image-to-AV tasks. It also adds a suite of inference examples, a codebase map, and SSIM-based similarity tests. Review feedback suggested improving the robustness of model detectors in the registry by using more comprehensive keyword matching and removing redundant manual overrides in the example scripts.
| model_detectors=[ | ||
| lambda path: | ||
| (("magihuman" in path.lower() or "magi_human" in path.lower() or "magi-human" in path.lower()) and | ||
| ("sr_540p" in path.lower() or "sr-540p" in path.lower() or "540p_sr" in path.lower() or "srpipeline" in | ||
| path.lower()) and "1080" not in path.lower() and "ti2v" not in path.lower()), | ||
| ], |
There was a problem hiding this comment.
The sr_540p model detector is missing the "sr540p" keyword (without underscore), which is inconsistent with the sr_1080p detector at line 309. This could cause a path like magihuman_sr540p to fail matching this detector and potentially fall through to the base model detector.
Consider using a more robust any() check to simplify the logic and ensure all common naming conventions are covered.
| model_detectors=[ | |
| lambda path: | |
| (("magihuman" in path.lower() or "magi_human" in path.lower() or "magi-human" in path.lower()) and | |
| ("sr_540p" in path.lower() or "sr-540p" in path.lower() or "540p_sr" in path.lower() or "srpipeline" in | |
| path.lower()) and "1080" not in path.lower() and "ti2v" not in path.lower()), | |
| ], | |
| model_detectors=[ | |
| lambda path: | |
| (("magihuman" in path.lower() or "magi_human" in path.lower() or "magi-human" in path.lower()) and | |
| any(x in path.lower() for x in ("sr_540p", "sr-540p", "540p_sr", "sr540p", "srpipeline")) and | |
| "1080" not in path.lower() and "ti2v" not in path.lower()), | |
| ], |
| model_detectors=[ | ||
| lambda path: | ||
| (("magihuman" in path.lower() or "magi_human" in path.lower() or "magi-human" in path.lower() | ||
| ) and "distill" not in path.lower() and "ti2v" not in path.lower() and "sr_540p" not in path.lower() and | ||
| "sr-540p" not in path.lower() and "540p_sr" not in path.lower() and "sr_1080p" not in path.lower() and | ||
| "sr-1080p" not in path.lower() and "1080p_sr" not in path.lower() and "srpipeline" not in path.lower()), | ||
| ], |
There was a problem hiding this comment.
The base model detector uses a fragile exclusion list that is missing several keywords used by other variants (e.g., "sr1080p", "sr540p", "1080", "540"). This makes the detector prone to false positives if a user provides a path for an SR variant that doesn't exactly match the current exclusion strings.
Since the base model is essentially the "fallback" MagiHuman variant, it's safer to exclude any path containing keywords associated with specialized variants.
model_detectors=[
lambda path:
(("magihuman" in path.lower() or "magi_human" in path.lower() or "magi-human" in path.lower())
and not any(x in path.lower() for x in ("distill", "ti2v", "sr", "1080", "540"))),
],| "FastVideo/MagiHuman-Diffusers/sr_1080p", | ||
| num_gpus=1, | ||
| override_pipeline_cls_name="MagiHumanSR1080pPipeline", | ||
| pipeline_config=MagiHumanSR1080pConfig(), |
There was a problem hiding this comment.
The manual overrides for override_pipeline_cls_name and pipeline_config appear to be redundant here. Since the model path "FastVideo/MagiHuman-Diffusers/sr_1080p" is correctly registered in fastvideo/registry.py (line 304) with the appropriate config and pipeline class, VideoGenerator.from_pretrained should be able to resolve these automatically, matching the cleaner pattern used in the sr_540p example.
| "FastVideo/MagiHuman-Diffusers/sr_1080p", | |
| num_gpus=1, | |
| override_pipeline_cls_name="MagiHumanSR1080pPipeline", | |
| pipeline_config=MagiHumanSR1080pConfig(), | |
| "FastVideo/MagiHuman-Diffusers/sr_1080p", | |
| num_gpus=1, |
547fcd9 to
06077ec
Compare
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI
🔴 PR merge requirementsWaiting for
This rule is failing.
|
|
This PR has merge conflicts with the base branch. Please rebase: git fetch origin main
git rebase origin/main
# Resolve any conflicts, then:
git push --force-with-lease |
361cc4c to
783be66
Compare
|
This PR has merge conflicts with the base branch. Please rebase: git fetch origin main
git rebase origin/main
# Resolve any conflicts, then:
git push --force-with-lease |
…ssion)
The activation switch. After this PR merges, MagiHuman is publicly
loadable via:
from fastvideo import VideoGenerator
gen = VideoGenerator.from_pretrained('FastVideo/MagiHuman-Diffusers/base')
Files:
- fastvideo/registry.py: 153 lines of register_configs/register_presets
calls covering all 4 variants x 2 modes (8 total entrypoints).
- examples/inference/basic/basic_magi_human{_,_ti2v,_distill,_distill_ti2v,
_sr540p,_sr540p_ti2v,_sr1080p,_sr1080p_ti2v}.py: 8 user-facing scripts.
- fastvideo/tests/ssim/test_magi_human_similarity.py: CI-eligible SSIM
regression test against the umbrella HF repo.
- .agents/memory/codebase-map/models/magi_human.md: codebase-map entry
(first per-model entry under the models/ subdir; sets the convention).
- fastvideo/pipelines/basic/magi_human/AGENTS.md: provenance section
finalized with all 8 PR numbers + the will/magi source SHA.
Verification:
- Existing tests on main: should still pass (no shared component changes
in this PR; the umbrella loader infra landed in PR-B / loader-infra).
- pre-commit run --all-files: clean.
- E2E smoke after activation: any of the 8 examples emits expected mp4
with hash dcf5f2bf6534c7c0d91e7353e42b23db on the base T2V variant.
Magi-Stack: 8/8
783be66 to
e541061
Compare
|
/test full |
|
I reviewed exact head
Before activation, please attach non-skipped exact-head evidence that the four newly public TI2V/SR paths load and write readable joint-AV outputs. The only durable E2E evidence currently recorded is base T2V. The purported CPU preflight cannot supply this evidence: it fails constructing the DiT with Nonblocking cleanup while revising: remove the broad Positive evidence: all eight scripts parse/import, their explicit manual class/config pairings are internally consistent, the TI2V image asset exists, Modal discovers the intended model split, and the already-seeded default L40S reference is readable H.264 + AAC. No retry is useful until the deterministic filename bug is fixed. |
|
This PR has merge conflicts with the base branch. Please rebase: git fetch origin main
git rebase origin/main
# Resolve any conflicts, then:
git push --force-with-lease |
Summary
The activation switch. After this PR merges, MagiHuman is publicly loadable:
Changes
fastvideo/registry.pyregister_configs/register_presetsfor all 4 variants × 2 modes (8 entrypoints)examples/inference/basic/basic_magi_human*.pyfastvideo/tests/ssim/test_magi_human_similarity.py.agents/memory/codebase-map/models/magi_human.mdmodels/(sets the convention)fastvideo/pipelines/basic/magi_human/AGENTS.mdwill/magisource SHAVerification
pre-commit run --files <changed paths>✓ (yapf, ruff, codespell, mypy, pymarkdown all green)VideoGenerator.from_pretrained("FastVideo/MagiHuman-Diffusers/<variant>")pattern; no per-script duplication of pipeline wiring.dcf5f2bf6534c7c0d91e7353e42b23db(stable across all 43 commits of the original port).fastvideo/tests/ssim/workflow.Stack context
Step 8 of 8 — the final PR in the decomposition. Stacked on:
Once #1293 and #1294 merge to main, the entire magi stack auto-rebases. The 8 magi PRs can then squash-merge in order.
Provenance
Source PR: #1280 (
will/magi@4e1603634d27c8e1b5c4cc5d9387f046547f5c49)Total decomposition: 9,812 LOC in the original PR → 10 stacked PRs + 2 prerequisite PRs (PR-A activation-trace, PR-B loader-infra), each independently reviewable. After all merge:
14 of 14parity tests bit-exact at the tip; mp4 hash preserved end-to-end.