Skip to content

Studio video: MiniMax-H3 offline loads reuse hash-matched VAEs cached under the old names - #14698

Closed
danielhanchen wants to merge 7 commits into
mainfrom
recheck_h3_offline_vae
Closed

danielhanchen wants to merge 7 commits into
mainfrom
recheck_h3_offline_vae

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Studio: MiniMax-H3 offline loads reuse the identical pre-move VAEs and conditioner

#14003 moved the MiniMax-H3 native VAEs to vae/official/ in unsloth/MiniMax-H3-GGUF and the hosted int8 conditioner to text_encoders/official/ in unsloth/MiniMax-H3-FP8. It also dropped the cache aliases to the Comfy-Org repack. Online that costs little: the new paths have the same sha256 as the old ones in the same repo, so huggingface_hub links the existing blob and nothing is downloaded again. A cache-only load is a different story. That covers an offline host, and an API load that may only open cached files. It looks the new filename up in the snapshot, finds nothing, and fails, even though the exact bytes are on disk under the old name.

Repro on main, using a seeded HF cache that holds the two VAEs at their pre-move paths (real sha256 blob names, sparse files) and HF_HUB_OFFLINE=1:

Cached copy Before #14003 main
unsloth/MiniMax-H3-GGUF vae/... loads LocalEntryNotFoundError
Comfy-Org/MiniMax-H3 vae/... loads LocalEntryNotFoundError

The user sees huggingface_hub's message, which says nothing about why a model that loaded yesterday fails today:

Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False.

h3_download_error only rewords access errors, so this message passes straight through.

Change

  • video_minimax_h3.H3_PRE_MOVE_COPIES pins the sha256 and size of each file this build reads: the two VAEs and the int8 conditioner. It also lists where an older install may hold the same bytes, in order: the unsloth repo's own pre-move path first, then the Comfy-Org repack it was copied from.
  • The table is only consulted when a fetch fails with a cache miss (LocalEntryNotFoundError). Even then a cached copy is used only when its sha256 matches the unsloth file. For a symlinked HF cache entry that is the blobs/<sha256> content address. A copied entry (no symlinks, e.g. Windows) gets hashed, once per process. This is a cache read and never a download. Every network fetch still goes only to the unsloth repos; h3_component_source and h3_te_quant_source are unchanged.
  • A local clone of the GGUF bundle made before the move (VAEs under vae/) is accepted the same way. The request builder routes on name and size, and the load checks the hash.
  • When nothing matches, the native load now raises an error the user can act on:
MiniMax-H3 needs its video VAE vae/official/minimax_h3_video_vae_fp16.safetensors (4.9 GiB) from unsloth/MiniMax-H3-GGUF, and it is not in the local Hugging Face cache. This load could not download it (offline, or a load that may only use cached files). Connect to the internet and load MiniMax-H3 once to fetch it; after that it loads offline.
  • The conditioner stager and loader use the same fallback. Before this, an offline miss dropped the load back to the dense encoder, and an install that staged only the int8 artifact does not have the dense encoder cached either.

Not changed

  • Wan2.2-TI2V-5B. The removed QuantStack row was only read by the image sd.cpp fetch map, which never serves a Wan load, so no Wan fetch path changed. The weights are sha256-identical to QuantStack's anyway (14 of 14 shared weight files).
  • Online installs that cached only the Comfy-Org copy still fetch the VAEs once from unsloth/*, as Studio: fetch every video component from unsloth repos #14003 intended.

Tests

New tests in tests/test_video_backend.py drive _run_load_h3_native with the VAE fetch raising a cache miss:

  • unsloth pre-move copy reused; Comfy-Org pre-move copy reused (sha256 checked)
  • copied (non-symlink) cache entry hashed and reused
  • an old-name file with different bytes is refused, and the error names the file, the repo and the fix
  • a pre-move local bundle is accepted; a wrong-bytes file in it is not
  • conditioner pre-move copy reused on a cache miss; other errors still propagate
  • the pinned table covers exactly the files this build reads

They fail on main and pass here.

…d conditioner

A cache-only load (offline, or an API load that may not download) looked up
the post-#14003 vae/official/ and text_encoders/official/ names, missed, and
failed with huggingface_hub's bare cache-miss message, although an install
staged before the move holds the same bytes under the old names. On a cache
miss only, reuse a cached copy whose sha256 matches the unsloth file (the
unsloth repo's pre-move path first, then the Comfy-Org repack it was copied
from), accept a pre-move local bundle the same way, and otherwise raise an
error naming the file, the repo and how to fetch it. Network fetches still go
only to unsloth repos.
@danielhanchen danielhanchen self-assigned this Oct 22, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-24T02:45:40.006959Z 05f3a74 Manual request
ℹ️ 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[bot]

This comment was marked as resolved.

…e file keeps the Hub source

The download plans (native and conditioner) and the loaders now ask one
question, h3_pre_move_copy_if_uncached: when the official-path file is not
cached and a hash-identical pre-move copy is, the plan stages nothing and the
load reads that copy, online or offline. The bundle request builder now
hash-checks a pre-move file before routing the load to it, so a same-size file
with other bytes keeps the Hub repo instead of failing at load.

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…nores unreachable official caches, honours cancel while hashing

- A conditioner cached only under its pre-move name stages no entry but still
  counts in required_bytes.
- Only roots the fetch can resolve (live and huggingface_hub's import-time
  root) let an official-path hit suppress the pre-move copy.
- The copied-entry hash loop checks the load's cancel event between chunks;
  the native load and the conditioner stager surface it as a cancel.

[skip ci]
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: cc9d450200

ℹ️ 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".

…ed size instead of hashing it

On a cache without symlinks (e.g. Windows) the download plan and the conditioner footprint hashed the 27 GB
pre-move conditioner and the VAEs synchronously, with no cancel, inside the first size request of a process.
Planners now pass verify=False: the pinned size decides unless a sha256 is already known (blob name or this
process's memo). Loads keep the full, cancellable hash check.

[skip ci]
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

… the staged file list

When the H3 VAEs are cached only under their pre-move names and another component is missing, the plan already left the VAEs out of the byte count but still listed their official names in the staged entry. snapshot_download only reuses the target repo's cache, so the staged load fetched about 5.8 GB the native loader would never read. Remove those files from the entry so files and bytes agree.

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 24, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 05f3a740f4

ℹ️ 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

Copy link
Copy Markdown
Member Author

Closing in favour of #15547.

Only installs from before #14003 hit this, and one online load fixes their cache. This PR adds sha256 matching and cache snapshot scans to every H3 load and size request, and it reverses #14003's rule that a load never reads Comfy-cached bytes. That is too much to carry for that case.

#15547 keeps the #14003 policy and fixes the part that actually hurts: a cache-only load (offline, or an auto-switch) now names the missing file and says to load once online, instead of a bare LocalEntryNotFoundError.

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Oct 27, 2026
…ow to fix it (unslothai#15547)

Replaces unslothai#14698 with a much smaller change.

## Problem

Users who installed MiniMax-H3 before unslothai#14003 have the VAEs cached under
the old names. Since unslothai#14003 the native H3 load looks them up under
`vae/official/...`, so a cache-only load fails with huggingface_hub's
bare `LocalEntryNotFoundError`. That message does not say which file is
missing or how to recover.

Cache-only loads are offline hosts and API-triggered auto-switch loads
(`media_auto_switch.py` loads with `local_files_only = not
user_initiated`, passed through `routes/video.py`). A single online,
user-started load fixes the cache.

## Fix

In the native H3 download loop (`_run_load_h3_native`), when the load is
cache-only and the fetch fails with a local cache miss (detected with
the existing `VideoBackend._te_fetch_miss`), raise a clear error
instead:

```
MiniMax-H3 needs its video VAE (vae/official/minimax_h3_video_vae_fp16.safetensors) from unsloth/MiniMax-H3-GGUF, and it is not in the local Hugging Face cache. This load may only use cached files (offline, or a load Studio started on its own), so it could not download it. Load MiniMax-H3 once while online (or reconnect) so Studio can fetch it; after that it loads offline.
```

The component name comes from the same file to role map
`h3_download_error` already uses (now a small shared helper). The
original exception is kept as `__cause__`. The load worker stores
`str(exc)` as the load progress error, so this text is what the UI and
API show.

Not changed: the unslothai#14003 policy (no reuse of old names or Comfy-cached
bytes, no hashing, no snapshot scans), online loads, and every other
error, which still goes through `h3_download_error` as before.

## Tests

New tests in `studio/backend/tests/test_sd_cpp_h3_matrix.py` drive
`_run_load_h3_native` with the video VAE fetch failing:

- cache-only load, `LocalEntryNotFoundError`: raises the new message
naming the file, and the text survives the load worker's error handling
unchanged (fails on main, passes here)
- online load, `LocalEntryNotFoundError`: the same exception object
propagates
- cache-only load, unrelated `OSError`: the same exception object
propagates

`pytest -n 4` over `test_sd_cpp_h3_matrix.py`, `test_video_backend.py`,
`test_video_offline_load.py`,
`test_h3_native_{server,resident,memory_fit,nonfinite}.py`:

| | failed | passed |
|---|---|---|
| main + new tests | 1
(`test_h3_cache_only_load_names_the_missing_vae_and_the_fix`) | 890 |
| this branch | 0 | 891 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant