Skip to content

[feat] Fix FLUX.1-dev port: native RoPE, parity tests, SSIM reference - #1321

Merged
SolitaryThinker merged 20 commits into
hao-ai-lab:mainfrom
Mister-Raggs:fix/flux-review
Jul 13, 2026
Merged

[feat] Fix FLUX.1-dev port: native RoPE, parity tests, SSIM reference#1321
SolitaryThinker merged 20 commits into
hao-ai-lab:mainfrom
Mister-Raggs:fix/flux-review

Conversation

@Mister-Raggs

Copy link
Copy Markdown
Contributor

Summary

  • Native RoPE: replaced runtime diffusers imports in flux.py with FastVideo-native apply_rotary_emb / get_1d_rotary_pos_embed; added sequence_dim param for FLUX [B,S,H,D] layout and fixed a CUDA device mismatch bug in get_1d_rotary_pos_embed
  • CLI args: added --use-embedded-guidance and --true-cfg-scale to SamplingParam for FLUX-style guidance
  • Tests + evidence: component loader, pipeline smoke, pipeline sanity, and DiT parity tests all passing on A40; SSIM reference image seeded
  • Docs: PORT_STATUS.md and README added under tests/local_tests/flux/

Test plan

All tests run on A40 (2026-05-11):

Test Result
tests/local_tests/flux/test_flux_dev_component_loaders.py PASS (54s)
tests/local_tests/pipelines/test_flux_dev_pipeline_smoke.py PASS (91s)
tests/local_tests/pipelines/test_flux_dev_pipeline_parity.py PASS — output finite, in [0,1], correct shape
fastvideo/tests/transformers/test_flux.py PASS — max_diff=0.50, mean_diff=0.04, median=0.00 (bf16 tail error over 57 layers, documented)
fastvideo/tests/ssim/test_flux_t2i_similarity.py (TORCH_SDPA) PASS — reference image seeded on A40

Notes

  • Pixel-level pipeline parity vs Diffusers is not enforced: both pipelines sample initial noise independently so identical seeds produce different images. DiT forward-pass parity (single forward, identical inputs) is the numerical validation.
  • DiT parity tolerance is atol=0.5 — calibrated to observed bfloat16 accumulation over 57 transformer layers (median diff = 0, mean = 0.04; real bugs produce mean >> 0.1).
  • FLASH_ATTN SSIM reference not seeded (not available on test pod); TORCH_SDPA reference committed.

Copilot AI review requested due to automatic review settings May 11, 2026 22:30
@mergify mergify Bot added type: feat New feature or capability scope: inference Inference pipeline, serving, CLI scope: infra CI, tests, Docker, build scope: model Model architecture (DiTs, encoders, VAEs) labels May 11, 2026
@mergify

mergify Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 PR merge requirements 👀 reviews

🔴 PR merge requirements

Waiting for

  • #approved-reviews-by>=1
This rule is failing.
  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success=full-suite-passed
  • check-success~=pre-commit
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@mergify

mergify Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

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

@mergify mergify Bot added the needs-rebase PR has merge conflicts label May 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the FLUX.1-dev text-to-image model, implementing the FluxTransformer2DModel, a dedicated pipeline, and corresponding configurations. The changes also update rotary embeddings for Flux-style layouts and include extensive parity and similarity tests. Feedback points out a bug in the timestep scaling for the forward context and suggests safer validation for ControlNet sample inputs to avoid potential runtime errors.

Comment thread fastvideo/models/dits/flux.py Outdated
get_forward_context()
forward_context = nullcontext()
except AssertionError:
ts0 = int(timestep[0].item()) if timestep.numel() > 0 else 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallback logic for ts0 incorrectly assumes that timestep contains raw integer values (0-1000). However, in the FLUX pipeline, timestep is passed as a scaled float in the range [0, 1]. This results in ts0 being either 0 or 1, which is incorrect for the forward context. It should be scaled back to the 0-1000 range to maintain consistency with how the context is set in the denoising stage.

Suggested change
ts0 = int(timestep[0].item()) if timestep.numel() > 0 else 0
ts0 = int(timestep[0].item() * 1000) if timestep.numel() > 0 else 0

Comment thread fastvideo/models/dits/flux.py Outdated
image_rotary_emb=image_rotary_emb,
joint_attention_kwargs=jkwargs,
)
if controlnet_block_samples is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using if controlnet_block_samples: is safer than is not None as it also handles the case where an empty list is provided, which would otherwise cause a ZeroDivisionError in the subsequent interval calculation.

Suggested change
if controlnet_block_samples is not None:
if controlnet_block_samples:

Comment thread fastvideo/models/dits/flux.py Outdated
image_rotary_emb=image_rotary_emb,
joint_attention_kwargs=jkwargs,
)
if controlnet_single_block_samples is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using if controlnet_single_block_samples: is safer than is not None as it also handles the case where an empty list is provided, preventing a potential ZeroDivisionError.

Suggested change
if controlnet_single_block_samples is not None:
if controlnet_single_block_samples:

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports and validates FLUX.1-dev support in FastVideo by adding a native Flux transformer + pipeline implementation, wiring model discovery/CLI sampling parameters, and introducing local + SSIM/parity tests to document and verify correctness against Diffusers.

Changes:

  • Added a FastVideo-native FLUX transformer (FluxTransformer2DModel) with native RoPE support and a composed FLUX T2I pipeline with dedicated stages (conditioning/latents/denoise/decode).
  • Registered FLUX configs/sampling params in the central registry and extended sampling/batch plumbing to support FLUX-style embedded guidance plus optional “true CFG”.
  • Added parity + SSIM tests and local-test documentation, and committed at least one seeded SSIM reference image (TORCH_SDPA).

Reviewed changes

Copilot reviewed 22 out of 25 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/local_tests/pipelines/test_flux_dev_pipeline_smoke.py Adds a short CUDA-only end-to-end FLUX smoke run.
tests/local_tests/pipelines/test_flux_dev_pipeline_parity.py Adds an end-to-end “sanity/parity” run vs Diffusers (shape/range/finite checks).
tests/local_tests/flux/test_flux_dev_component_loaders.py Adds loader smoke tests for FLUX components from Diffusers-layout weights.
tests/local_tests/flux/README.md Documents how to run FLUX local tests (currently has some stale status lines).
tests/local_tests/flux/PORT_STATUS.md Tracks port status/evidence (currently has stale SSIM reference status).
fastvideo/tests/utils.py Extends SSIM utility to treat images as single-frame clips.
fastvideo/tests/transformers/test_flux.py Adds DiT forward-pass parity test vs Diffusers.
fastvideo/tests/ssim/test_flux_t2i_similarity.py Adds SSIM regression test for FLUX T2I (needs backend/ref alignment).
fastvideo/tests/ssim/inference_similarity_utils.py Generalizes similarity utils from video-only to media (video/image).
fastvideo/registry.py Registers FLUX pipeline/sampling config and adds an early-return guard in config registration.
fastvideo/pipelines/stages/flux_stages.py Implements FLUX-specific pipeline stages (packed latents, dynamic mu shifting, embedded/true CFG).
fastvideo/pipelines/pipeline_batch_info.py Adds use_embedded_guidance + true_cfg_scale and updates CFG gating logic.
fastvideo/pipelines/basic/flux/flux_pipeline.py Adds composed FLUX pipeline wiring the new stages.
fastvideo/models/dits/flux.py Adds the FLUX transformer implementation using native RoPE helpers.
fastvideo/layers/rotary_embedding.py Adds sequence_dim support for RoPE application and aligns 1D RoPE with Diffusers calling conventions.
fastvideo/configs/sample/flux.py Adds FLUX-specific sampling defaults.
fastvideo/configs/sample/base.py Adds CLI-exposed sampling params for embedded guidance / true CFG.
fastvideo/configs/pipelines/flux.py Adds FLUX pipeline config (CLIP+T5 layout, tokenizer constraints, precisions).
fastvideo/configs/models/dits/flux.py Adds FLUX DiT config/arch defaults.
fastvideo/configs/models/dits/init.py Exports FluxDiTConfig.
examples/inference/basic/basic_flux_dev.py Adds a simple FLUX.1-dev T2I example script.
.gitignore Updates ignore rules to allow committed SSIM reference media (mp4/png).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

reason="FLUX T2I SSIM test requires CUDA",
)
@pytest.mark.parametrize("prompt", TEST_PROMPTS)
@pytest.mark.parametrize("attention_backend_name", ["TORCH_SDPA", "FLASH_ATTN"])
Comment thread tests/local_tests/flux/README.md Outdated
pytest fastvideo/tests/ssim/test_flux_t2i_similarity.py -vs
```

Status: reference images not yet committed — see PORT_STATUS.md.
Comment on lines +33 to +37
| Item | Status |
|---|---|
| SSIM test | written (fastvideo/tests/ssim/test_flux_t2i_similarity.py) |
| Reference images committed | not yet — pending SSIM seeding run |

Comment thread fastvideo/models/dits/flux.py Outdated
get_forward_context()
forward_context = nullcontext()
except AssertionError:
ts0 = int(timestep[0].item()) if timestep.numel() > 0 else 0


def test_flux_dev_pipeline_short_run_finite_output(
monkeypatch: pytest.MonkeyPatch) -> None:
Comment thread tests/local_tests/flux/README.md Outdated
pytest tests/local_tests/pipelines/test_flux_dev_pipeline_parity.py -vs
```

Status: requires weights — pending local run (see PORT_STATUS.md).
Comment thread tests/local_tests/flux/README.md Outdated
```

Status: requires weights — not run in CI.
Pass evidence: pending (see PORT_STATUS.md).
@mergify mergify Bot added the scope: docs Documentation label May 12, 2026
@mergify mergify Bot removed the needs-rebase PR has merge conflicts label May 12, 2026
Mister-Raggs added a commit to Mister-Raggs/FastVideo that referenced this pull request May 12, 2026
add-model-02-parity:
- Use .item() before f-string formatting so the snippet portably works on
  older PyTorch versions that lack `__format__` on 0-dim tensors.
- Switch p99 to torch.quantile (cleaner, no off-by-one risk for small N
  vs. kthvalue(int(0.99 * N))).
- Document why both changes matter.

seed-ssim-references:
- .png artefact: correct trigger is `workload_type.value.endswith("2i")`
  (per `VideoGenerator._is_image_workload`), not "num_frames=1". On
  current main the SSIM helpers (`_find_reference_video`,
  `output_video_name`) hardcode .mp4; consuming .png references requires
  the `media_extension` parameter introduced in PR hao-ai-lab#1321.
- T2I gotcha: add `mkdir -p` before `cp` so the destination is created.
- .gitignore: clarify that `reference_videos_cli.py upload` uses
  `huggingface_hub.upload_folder` (filesystem upload, not git), so
  `git add -f` only matters for local commits. Note that the
  `fastvideo/tests/ssim/reference_videos/**` catch-all near `.gitignore:94`
  currently overrides the earlier `*.mp4` negation, so every reference
  file requires `git add -f` regardless of extension.
Mister-Raggs added a commit to Mister-Raggs/FastVideo that referenced this pull request May 26, 2026
Three concrete, generalizable improvements derived from PR hao-ai-lab#1321 (FLUX.1-dev
port fixes) that the next model-port will hit:

1. add-model-02-parity — Tolerance guide stopped at "Full DiT, cross-kernel
   bf16: 0.1". FLUX (57 layers) needed atol=0.5 — observed max=0.5, mean=0.04,
   median=0 on A40. Added a "Very deep DiT (50+ layers), bf16" row and a
   "Calibrating atol > 0.1" subsection that requires diagnostic prints
   (max/mean/median/p99) so reviewers can verify the calibration without
   rerunning. Also distinguishes the healthy bf16-tail signature (median≈0,
   mean<<atol) from a real bug signature (mean_diff>>0.1).

2. add-model-09-pipeline — Step 4 listed two surfaces (sampling_param.py + CLI
   args) for adding new generation kwargs. The current architecture has four:
   sampling_param.py, api/schema.py SamplingConfig, the schema_parity_inventory
   YAML (moved + expected_dests), and the test_parser.py roundtrip dict
   snapshot. Missing any one fails CI with a different error; we hit three
   separate failures during PR hao-ai-lab#1321 before getting it green. Expanded Step 4
   to enumerate all four with the failure mode for each.

3. seed-ssim-references — Skill documented .mp4 and .pt artefacts. T2I tests
   that reuse run_text_to_video_similarity_test produce .png when num_frames=1;
   reference_videos_cli.py copy-local silently skips PNG (walks .mp4/.pt only,
   reports "0 copied files"). Added .png as a third artefact type and a step-5
   gotcha with the manual cp workaround plus the .gitignore negation pitfall.

Each change is a small in-place edit to an existing skill file. No new skills
added, no skill removed. Verifiable against the FLUX port: every failure mode
called out here has a corresponding commit in PR hao-ai-lab#1321 (c82dd31 for atol,
d1a63c8 for schema parity inventory, aabf179 for test_parser snapshot,
5b5fdcf for SSIM PNG copy).
Mister-Raggs added a commit to Mister-Raggs/FastVideo that referenced this pull request May 26, 2026
add-model-02-parity:
- Use .item() before f-string formatting so the snippet portably works on
  older PyTorch versions that lack `__format__` on 0-dim tensors.
- Switch p99 to torch.quantile (cleaner, no off-by-one risk for small N
  vs. kthvalue(int(0.99 * N))).
- Document why both changes matter.

seed-ssim-references:
- .png artefact: correct trigger is `workload_type.value.endswith("2i")`
  (per `VideoGenerator._is_image_workload`), not "num_frames=1". On
  current main the SSIM helpers (`_find_reference_video`,
  `output_video_name`) hardcode .mp4; consuming .png references requires
  the `media_extension` parameter introduced in PR hao-ai-lab#1321.
- T2I gotcha: add `mkdir -p` before `cp` so the destination is created.
- .gitignore: clarify that `reference_videos_cli.py upload` uses
  `huggingface_hub.upload_folder` (filesystem upload, not git), so
  `git add -f` only matters for local commits. Note that the
  `fastvideo/tests/ssim/reference_videos/**` catch-all near `.gitignore:94`
  currently overrides the earlier `*.mp4` negation, so every reference
  file requires `git add -f` regardless of extension.
@mergify

mergify Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

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

@mergify mergify Bot added the needs-rebase PR has merge conflicts label May 29, 2026
@mergify mergify Bot removed the needs-rebase PR has merge conflicts label May 31, 2026
@mergify

mergify Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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

@mergify mergify Bot added the needs-rebase PR has merge conflicts label Jun 9, 2026
@SolitaryThinker

Copy link
Copy Markdown
Collaborator

Hi @Mister-Raggs — automated review from Gob, one of @SolitaryThinker's AI reviewers. Findings aren't all human-verified; ping @SolitaryThinker if anything looks off.

TL;DR

The DiT port, pipeline stages, native RoPE refactor, and parity tests are well-structured; both prior gemini-bot findings (timestep scaling, ControlNet input guard) are addressed at the current HEAD. However, the headline SSIM regression test imports FluxSamplingParam from a module that does not exist in the tree (fastvideo.configs.sample.flux), so the SSIM gate cannot collect under pytest. Smaller issues: a new repeat_interleave_real kwarg added to a shared RoPE helper is never honored, and PORT_STATUS.md still lists a resolved blocker.

Verdict: ship-with-fixes

  • S0 (blockers): 1
  • S1 (must-fix): 2
  • S2 (should-fix; surfaced if persistent or important): 2
  • S3 (discussion): not shown here; see review.md

Pre-merge gate (not a code finding): PR is CONFLICTING (DIRTY) / needs-rebase — must rebase on main before merge.


Findings (formatted for upload)

[S0] SSIM regression test imports FluxSamplingParam from a non-existent module

What: fastvideo/tests/ssim/test_flux_t2i_similarity.py:10 does from fastvideo.configs.sample.flux import FluxSamplingParam, but fastvideo/configs/sample/ does not exist in the tree (verified by git ls-tree -r). FluxSamplingParam is defined in fastvideo/api/flux.py (added by this PR). Pytest will raise ModuleNotFoundError at collection time before skipif can take effect, so the test is a hard error rather than a skip.
Why it matters: This is the SSIM regression gate the PR claims to install — the reason the 92 KB reference PNG is committed. With the broken import, the gate is non-functional and the "PASS — reference image seeded on A40" line in the PR body cannot be reproduced from the code as committed.
Suggested fix: Replace the import with from fastvideo.api.flux import FluxSamplingParam. Run pytest --collect-only fastvideo/tests/ssim/test_flux_t2i_similarity.py locally to confirm.
Evidence: fastvideo/tests/ssim/test_flux_t2i_similarity.py:10; fastvideo/api/flux.py:11.

[S1] FLUX timestep prep silently falls back when scheduler lacks use_dynamic_shifting

What: FluxTimestepPreparationStage.forward (fastvideo/pipelines/stages/flux_stages.py:107-110) returns the base implementation without warning whenever scheduler.config.use_dynamic_shifting is False. For FLUX.1-dev the on-disk scheduler config has use_dynamic_shifting=True, but a misconfigured scheduler (e.g. a user feeding in a FLUX.1-schnell scheduler or a SD3.5 scheduler) silently degrades to flat-shift sampling and produces numerically wrong, plausibly-finite output.
Why it matters: Silent numerical wrongness. The output passes the parity test's shape/range/finite checks but is off-distribution; this is the failure class the model-port rubric flags as merge-blocking.
Suggested fix: In the fallback path, log a warning when the loaded scheduler is being used inside FluxPipelineConfig but use_dynamic_shifting is False. Alternatively assert in FluxPipelineConfig.__post_init__ if a FLUX pipeline is being constructed.
Evidence: fastvideo/pipelines/stages/flux_stages.py:107-110; fastvideo/configs/pipelines/flux.py:40.

[S1] repeat_interleave_real kwarg added to get_1d_rotary_pos_embed but never used

What: fastvideo/layers/rotary_embedding.py:300 adds repeat_interleave_real: bool | None = None to the shared get_1d_rotary_pos_embed signature, but the function body never references it. freqs_cos and freqs_sin are unconditionally passed through repeat_interleave(2, dim=-1) whenever use_real=True (line 345-346). For this PR's only caller (FluxPosEmbed.forward passing repeat_interleave_real=True) the result happens to be correct, but the kwarg is dead and the docstring still describes the legacy behavior. A future caller passing repeat_interleave_real=False to ask for half-D output will silently receive full-D output.
Why it matters: Silent contract drift in a shared layer used by Cosmos, Cosmos2.5, Gen3C, HunyuanVideo/GameCraft, and now FLUX. Other ports will eventually be misled.
Suggested fix: Either honor the kwarg by gating the repeat_interleave on if repeat_interleave_real is None or repeat_interleave_real:, or drop the kwarg entirely (the FLUX caller can simply not pass it).
Evidence: fastvideo/layers/rotary_embedding.py:300, 333-347; fastvideo/models/dits/flux.py:54-61.

[S2] PORT_STATUS.md "Known Blockers" still claims SSIM references are uncommitted

What: tests/local_tests/flux/PORT_STATUS.md:50-53 lists "SSIM reference images not committed — test will FileNotFoundError before comparison" as Known Blocker #1, but the file fastvideo/tests/ssim/reference_videos/.../black-forest-labs__FLUX.1-dev/TORCH_SDPA/a photo of a cat.png is committed by this PR and the "Quality" table at line 38 already says so. The bot reviewer flagged this on the current HEAD and it remains unfixed.
Why it matters: Persistent doc drift in the canonical port-status file. Downstream agents reading PORT_STATUS.md will conclude the SSIM gate is unseeded when it actually is (modulo the S0 import bug).
Suggested fix: Remove Known Blocker #1 entirely, or rewrite as: "TORCH_SDPA reference committed; FLASH_ATTN reference pending pod availability."
Evidence: tests/local_tests/flux/PORT_STATUS.md:50-53.

[S2] PORT_STATUS.md declares a registry-ordering "accepted risk" without a follow-up issue

What: tests/local_tests/flux/PORT_STATUS.md:55-58 documents Known Blocker #2: a registry early-return guard that allegedly causes FLUX registration to be silently skipped if any test pre-populates _CONFIG_REGISTRY before _register_configs() runs, with the resolution "Known pre-existing pattern; accepted risk for now."
Why it matters: The blocker either exists (in which case FLUX may be silently invisible in some test orderings and "accepted risk" is not a real resolution for a model addition) or is fictional (in which case it should not be documented as a blocker). Either outcome warrants action.
Suggested fix: Add a 1-line test that imports FluxPipelineConfig, triggers _discover_and_register_pipelines(), and asserts FLUX is in _PIPELINE_CONFIG_REGISTRY. If it passes, remove the blocker. If it fails, file a tracking issue and link it here.
Evidence: tests/local_tests/flux/PORT_STATUS.md:55-58.


— Gob (@SolitaryThinker's AI reviewer). Full review (including S3 items) is archived locally.

@mergify mergify Bot removed the needs-rebase PR has merge conflicts label Jun 21, 2026
@SolitaryThinker

Copy link
Copy Markdown
Collaborator

Hi @Mister-Raggs — differential re-review from Gob, one of @SolitaryThinker's AI reviewers. The prior review (verdict: ship-with-fixes) is at #1321 (comment). Findings aren't all human-verified; ping @SolitaryThinker if anything looks off.

TL;DR

All 5 prior findings (1× S0, 2× S1, 2× S2-persistent) plus the pre-merge rebase landed cleanly across the 5 fix commits. No new public-surface concerns. Tier moves up from ship-with-fixes to approve-with-followup; only the deferred S3 discussion items remain as a follow-up issue.

Verdict: approve-with-followup (was ship-with-fixes)

Prior findings status (697a4b341a9da0)

Prior finding Status Address commit Evidence
[S0] SSIM test imports FluxSamplingParam from non-existent fastvideo.configs.sample.flux ✅ FIXED f7cf6afd + 41a9da0a fastvideo/tests/ssim/test_flux_t2i_similarity.py:10 now from fastvideo.api.flux import FluxSamplingParam; AST parse OK
[S1-A] FLUX timestep prep silently falls back on use_dynamic_shifting=False ✅ FIXED 41a9da0a fastvideo/pipelines/stages/flux_stages.py:128-143 emits logger.warning(...) on BOTH the no-mu and use_dynamic_shifting=False fallback paths with "output quality may degrade" wording
[S1-B] repeat_interleave_real kwarg added to get_1d_rotary_pos_embed but never read ✅ FIXED 41a9da0a Kwarg dropped from fastvideo/layers/rotary_embedding.py:298 signature AND from the FLUX call site at fastvideo/models/dits/flux.py:55-60. git grep repeat_interleave_real at HEAD returns 0 matches. Behavior preserved (the use_real=True branch already does the interleaved expansion)
[S2-persistent] PORT_STATUS Known Blocker #1 contradicted committed SSIM ref ✅ FIXED 41a9da0a tests/local_tests/flux/PORT_STATUS.md:47-52 now reads ## Known Blockers\n\nNone. with a ## Resolved section explaining the TORCH_SDPA ref is committed
[S2-persistent] PORT_STATUS Known Blocker #2 "accepted risk" with no tracking issue ✅ FIXED 41a9da0a tests/local_tests/flux/PORT_STATUS.md:55-58 resolves it by asserting FLUX is registered unconditionally in _register_configs() with no early-return guard (i.e. the blocker was fictional after the registry refactor)
Pre-merge rebase (was CONFLICTING/DIRTY) ✅ DONE rebase landed gh pr view 1321 returns mergeable=MERGEABLE, mergeStateStatus=BLOCKED (blocked only on reviews, not git state)

Tally: 6/6 ✅

What changed

  • SSIM import restored to fastvideo.api.flux so pytest can collect test_flux_t2i_similarity.py (f7cf6afd → finalized in 41a9da0a).
  • Timestep silent-fallback now emits a logger.warning on BOTH the no-mu AND use_dynamic_shifting=False paths — broader coverage than the prior review asked for.
  • Dead repeat_interleave_real kwarg dropped from the helper signature and the FLUX call site; use_real=True already produces the interleaved expansion FLUX needs, so no behavior change.
  • PORT_STATUS.md Known Blockers section is now empty; both prior entries reclassified to a ## Resolved section with one-paragraph justifications. Last updated bumped to 2026-06-20.
  • Schema parity hygiene (commits 312a322d, 02c3ad33, 25c8004d): use_embedded_guidance and true_cfg_scale registered in docs/design/inference_schema_parity_inventory.yaml, use_embedded_guidance added to SamplingConfig in fastvideo/api/schema.py, and the YAML-roundtrip test snapshot updated to match — keeps test_inventory_targets_exist_in_typed_schema, test_cli_dest_inventory_matches_live_parsers, and test_load_run_config_supports_yaml_roundtrip green.
  • Rebase onto origin/main landed cleanly.

Extras worth calling out

  • The timestep-fallback fix warns on BOTH paths (the prior review only flagged one). This is good defensive hardening for the case where a user swaps in a non-FlowMatch scheduler.
  • The schema-parity / test-snapshot fixes are pure good-citizen work — they weren't in the review ask but caught the CI regressions that the new use_embedded_guidance/true_cfg_scale fields would have caused.

Remaining items

None blocking. The 5 prior S3 discussion items (FluxDenoisingStage two-pass cost docstring; DiT parity rtol secondary check; _calculate_mu helper lift; basic_flux_dev.py CLI flag; unused FluxPipelineConfig.flow_shift) are deferred — recommend collecting them in a single low-priority follow-up issue. FLASH_ATTN SSIM reference seeding is already tracked in PORT_STATUS Quality.


— Gob (@SolitaryThinker's AI reviewer). Full re-review with quoted code archived locally.

@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

@mergify mergify Bot added the needs-rebase PR has merge conflicts label Jul 13, 2026
Ishxn20 and others added 20 commits July 13, 2026 00:10
… layer

Add sequence_dim param to apply_rotary_emb (supports [B,S,H,D] FLUX
layout alongside existing [B,H,S,D] default). Add freqs_dtype and
repeat_interleave_real aliases to get_1d_rotary_pos_embed for
Diffusers-compatible call sites. Remove diffusers.models.embeddings
import from fastvideo/models/dits/flux.py.
… config

- Export FluxDiTConfig from configs/models/dits/__init__.py (consistent
  with all other DiT families)
- Align loader smoke test to use T5LargeConfig matching FluxPipelineConfig
- Add tests/local_tests/flux/README.md with setup and test commands
- Add tests/local_tests/flux/PORT_STATUS.md tracking component/pipeline/
  quality status and known blockers
Both fields were declared in SamplingParam but had no --use-embedded-guidance
or --true-cfg-scale CLI arguments, making them inaccessible from the
command line without editing the example script.
Compares FastVideo FluxPipeline decoded image against Diffusers
FluxPipeline under identical prompt/seed/steps (4 steps, 256x256,
seed=42, atol=5e-2). Requires official_weights/FLUX.1-dev and CUDA.
Updates README and PORT_STATUS to reflect test exists, pending run.
CI fixes:
- Add use_embedded_guidance to SamplingConfig in fastvideo/api/schema.py
  (test_inventory_targets_exist_in_typed_schema walked request.sampling but
  field was missing from the dataclass)
- Add true_cfg_scale and use_embedded_guidance to expected_dests in
  inference_schema_parity_inventory.yaml generate section
  (test_cli_dest_inventory_matches_live_parsers found both dests on the
  live parser but not in the inventory)

Gemini/Copilot review fixes:
- flux.py: scale ts0 by *1000 when timestep is float — FLUX passes timestep
  in [0,1] so the old int(item()) produced ts0=0 for every non-zero step
- flux.py: use truthiness guard on controlnet samples instead of is not None
  to prevent ZeroDivisionError on empty-list input
- test_flux_t2i_similarity.py: restrict SSIM parametrize to TORCH_SDPA;
  FLASH_ATTN reference not yet seeded (pending Will confirmation on coverage)
- docs: update README.md and PORT_STATUS.md to reflect PASS evidence and
  committed SSIM references (TORCH_SDPA, A40, 2026-05-11)
- test_flux_dev_pipeline_smoke.py: fix function signature indent (PEP 8)
SamplingConfig gained use_embedded_guidance in the rebase; the
hardcoded config_to_dict snapshot in test_load_run_config_supports_yaml_roundtrip
was missing the new field, causing a dict-equality assertion failure.
… rename

fastvideo/api/flux.py still imported SamplingParam from
fastvideo.configs.sample.base (old path removed on main), causing a
ModuleNotFoundError at import time. Updated to fastvideo.api.sampling_param.
…p dead RoPE kwarg, refresh PORT_STATUS

Addresses the 2026-06-21 review of the FLUX.1-dev port:

- test_flux_t2i_similarity.py imported FluxSamplingParam from the removed
  fastvideo.configs.sample.flux; point it at fastvideo.api.flux so the SSIM
  gate can collect.
- FluxTimestepPreparationStage silently fell back to the base schedule when
  the scheduler lacked `mu` or had use_dynamic_shifting=False, skipping FLUX's
  resolution-dependent shift. Emit a warning on both fallback paths.
- repeat_interleave_real was added to get_1d_rotary_pos_embed but never read
  (expansion is driven by use_real); drop the dead kwarg and its FLUX call-site
  argument. No behavior change — use_real=True already yields the interleaved
  expansion FLUX needs.
- PORT_STATUS.md: both "Known Blockers" were stale (SSIM TORCH_SDPA reference
  is committed; FLUX registers unconditionally with no early-return guard).
  Move them to a Resolved section and bump the date.
…d_video

Both run_text_to_video_similarity_test and run_image_to_video_similarity_test
define output_media_name but passed the never-assigned output_video_name to
_remove_stale_generated_video, a NameError that crashed the FLUX SSIM test
before generation. Leftover from the video->media rename.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mergify mergify Bot removed the needs-rebase PR has merge conflicts label Jul 13, 2026
@SolitaryThinker

Copy link
Copy Markdown
Collaborator

/test full

@SolitaryThinker
SolitaryThinker merged commit b063f8c into hao-ai-lab:main Jul 13, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready PR is ready to merge scope: docs Documentation scope: inference Inference pipeline, serving, CLI scope: infra CI, tests, Docker, build scope: model Model architecture (DiTs, encoders, VAEs) type: feat New feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants