Skip to content

Model catalog network check: judge FLUX.3 Klein by the mirror the backend fetches - #14316

Merged
danielhanchen merged 1 commit into
mainfrom
ci/catalog-fetched-from-mirror
Oct 20, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/catalog-fetched-from-mirror

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

The scheduled Model catalog network check failed on main (run 39381974211, fb372c1):

black-forest-labs/flux-3-image-klein-base: the Hub reports gated="auto" but the catalog entry has no `gated: true`, so an anonymous download 401s
black-forest-labs/flux-3-image-klein: the Hub reports gated="auto" but the catalog entry has no `gated: true`, so an anonymous download 401s

Both repos are gated on the Hub, but users never download them. The FLUX.3 Klein bf16 rows deliberately keep the BFL ids (#13933, #14184), and the backend fetches those ids from the open unsloth/flux-3-image-klein-FP8 and unsloth/flux-3-image-klein-base-FP8 repos, which carry the upstream diffusers folders byte-identical (_GATED_MIRROR_PAIRS in diffusion_families.py). This is the first scheduled run of the check since the rows were added: the last one completed on 2026-10-01, and the 2026-10-19 run was cancelled.

Adding gated: true would be wrong. The router skips a gated, not-downloaded artifact on a bare group click, so the working bf16 row would stop being offered. The catalog is right and the check was judging the wrong repo.

Fix

  • ModelArtifact.fetchedFrom: the open repo the backend downloads a vendor id from. Set on the two FLUX.3 Klein bf16 rows.
  • The network check judges gating and declared files on fetchedFrom when it is set, otherwise on the repo id as before.
  • tests/model-catalog-fetched-from.test.ts (frontend unit tests, every PR) reads _GATED_MIRROR_PAIRS and _VIDEO_GATED_MIRROR_PAIRS from diffusion_families.py and requires every fetchedFrom to be one of those pairs, with no gated: true on the row. A catalog claim of a mirror the backend does not use therefore fails on the PR, not at download time.

No UI change: the field is read only by the check and the test.

Testing

  • npm run catalog:check:network against the live Hub: passes (every declared repo, file and gated flag agrees with the Hub). On main it fails with the two errors above.
  • Pointing the base row's fetchedFrom at the wrong mirror makes both new tests fail.
  • npm run catalog:check and the full frontend suite (12886 tests, 0 failed) pass. npm run build passes, and the startup bundle stays within budget (0.1 KB raw to spare).

…kend fetches

The bf16 rows keep the gated black-forest-labs ids, which the backend fetches from the open unsloth FP8 repos (_GATED_MIRROR_PAIRS). The nightly check read the vendor gate and failed. A new fetchedFrom field names the mirror, the network check judges it, and a unit test keeps each fetchedFrom inside the backend's gated mirror table.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T06:59:29.978488Z 4493e6b Manual request
🔒 Security Review ⚠️ Failed 2026-10-20T06:56:34.349701Z 4493e6b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 4493e6bc36

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit f142f57 into main Oct 20, 2026
@danielhanchen
danielhanchen deleted the ci/catalog-fetched-from-mirror branch October 20, 2026 07:50
danielhanchen added a commit that referenced this pull request Oct 20, 2026
… tables by any spelling (#14318)

## Problem

`(Python 3.13, a-k)` fails on every PR since #14310 merged (for example
#14316 and #14317, both on base fb372c1):

```
studio/backend/tests/test_diffusion_segment_quant.py: in test_skeleton_buffers_match_from_pretrained
    assert dense.keys() == built.keys() and any("rope" in name for name in dense)
```

#14310 showed the same failure on its own run before merging. Reproduced
locally with transformers 5.18 (CI resolves 5.17.0); the 4.57 floor has
no `Sam3Model`, so the test skips there.

There are two layers:

1. With transformers 5.x the RoPE buffers are named
`rotary_emb.inv_freq`, `rotary_emb.original_inv_freq` and
`position_ids`; none contains `rope`.
2. Behind that check, the dtype comparison fails as well:
`from_pretrained(dtype = bfloat16)` casts the ViT's `position_ids` to
bf16 on 5.18, while `_build_skeleton` builds them in float32 on purpose.
They are not just a different dtype: layer 1 (global attention) has
different values in bf16, and swapping the skeleton's buffers into the
dense model changes the vision encoder output. That is exactly the 0.04
shift the test's docstring describes, so the skeleton is right and a
bf16 load is not a valid reference.

## Fix

Test only:

- The reference is `from_pretrained(dtype = float32)`, the exact tables
the skeleton is meant to reproduce on every transformers version.
- The RoPE presence check matches `rope`, `rotary` or `position_ids`.

## Testing

- `test_diffusion_segment_quant.py` with transformers 5.18: 37 passed, 3
skipped. On main the skeleton test fails as in CI.
- Building the skeleton without `_default_dtype(torch.float32)` (the
regression the test exists for) makes it fail on `position_ids`.
- `test_diffusion_segment.py` with `test_diffusion_segment_quant.py`:
109 passed, 3 skipped.

## Not covered here

The dense bf16 path (`Sam3Model.from_pretrained(..., dtype = dtype)` in
`diffusion_segment.py`) gets the rounded `position_ids` on 5.18, so on
that release its masks differ from the pre-quantized path's. That is a
product question for the segmenter, separate from this CI fix.
danielhanchen added a commit that referenced this pull request Oct 20, 2026
)

## Problem

`Frontend build + bundle sanity` is red for every PR based on current
main. Main itself builds over the startup budget:

```
eager startup JS: 6684.2 KB raw, 2012.7 KB transfer, 96 chunks
over the startup budget: raw 6684.2 KB > 6683.8 KB
```

## Measurement

Exact totals, one machine and build, Node 24, 96 chunks throughout:

| Commit | Raw (B) | Transfer (B) |
|---|---|---|
| 22a0bea (last in-budget main) | 6,844,101 | 2,060,889 |
| 6a19cb2 (before #14312) | 6,844,101 | 2,060,887 |
| b32d544 (#14312, FLUX.3 workflows, controls and LoRAs) | 6,844,527
| 2,061,025 |
| d3a8257 (main, after #14228) | 6,844,622 | 2,061,040 |

#14312 adds 426 B raw / 138 B transfer, and #14228 adds 95 B raw / 15 B
transfer. Both are ordinary feature growth on chunks the startup set
already loads; the chunk count is unchanged.

## Change

`BUDGET` in `studio/frontend/scripts/check-bundle-budget.ts` is raised
to the main build plus the same 160 B raw / 189 B transfer margin as
earlier raises: `rawBytes` 6,844,782 and `transferBytes` 2,061,229. A
comment entry records the numbers above.

## Testing

- `npm ci && npm run build && npx tsx scripts/check-bundle-budget.ts` on
this branch: `within budget (0.2 KB transfer, 0.2 KB raw to spare)`. On
main, the over-budget output above.
- #14316 (catalog `fetchedFrom`) builds to the identical byte count on
top of main, so it fits under this budget as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant