Skip to content

[staging codex review] #11786 feat(install): fall back to CERNET and npmmirror when package hosts are blocked or slow - #87

Closed
Lyxot wants to merge 20 commits into
staging/11786-basefrom
staging/11786
Closed

Lyxot wants to merge 20 commits into
staging/11786-basefrom
staging/11786

Conversation

@Lyxot

@Lyxot Lyxot commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Staging copy of unslothai#11786 for Codex review and CI. Base is the upstream PR merge base, so the diff is exactly the PR. Head is identical to the upstream PR head (66a865a6c1). Do not merge; closed once Codex converges and CI finishes.

Summary

In mainland China, pypi.org, download.pytorch.org, nodejs.org, registry.npmjs.org and releases.astral.sh are often blocked or run at a few hundred KB/s. A fresh Unsloth Studio install there either times out or takes hours downloading torch, Node, uv and Python builds. This PR makes install.sh, studio/setup.sh, install.ps1 and studio/setup.ps1 detect that and switch each affected host to a mirror. Healthy hosts are left untouched. The switch goes through the environment variables the package tools already read.

Default host Mirror
pypi.org (and the pinned uv wheel) https://tuna.mirrors.cernet.edu.cn/pypi/web/simple
download.pytorch.org https://tuna.mirrors.cernet.edu.cn/pytorch/whl (UNSLOTH_PYTORCH_MIRROR)
nodejs.org https://registry.npmmirror.com/-/binary/node (UNSLOTH_NODE_MIRROR)
registry.npmjs.org https://registry.npmmirror.com (UNSLOTH_NPM_REGISTRY)
releases.astral.sh (Python builds, POSIX only) https://registry.npmmirror.com/-/binary/python-build-standalone

CERNET's tuna.mirrors.cernet.edu.cn is a redirector. It sends each tree to a healthy university mirror, which gives failover beyond a single mirror.

How it works

  • Speed probe before the first install. Each default host is timed on a 1 MiB range of a real artifact it serves. A host below 1 MiB/s, or one whose index does not answer, is raced against its mirror. It is switched only when the mirror is faster and the mirror's own index answers. Hosts are probed in parallel. install.sh/install.ps1 probe up front and pass the result to setup.sh/setup.ps1. When setup runs on its own (unsloth studio update), it arms the one-shot mirror retries at startup without touching the network, and probes only right before a step that downloads Python packages (the dependency pass or a Transformers sidecar rebuild), so an update with nothing to install contacts no package host. A --local update, which re-runs the dependency pass from uv's cache every time, relies on the armed retries instead of probing.
  • Mirror-only PyPI index. A switched PyPI host uses the mirror alone (UV_DEFAULT_INDEX / PIP_INDEX_URL). pypi.org is deliberately not kept alongside it: uv's unsafe-first-match queries every index for every package, so a pypi.org that drops mid-install would fail every later step.
  • Unsynced-release rerun. If pypi.org was only slow and a resolve fails with "version/package not available" output (a fresh release the mirror has not synced yet), that step reruns once with pypi.org behind the mirror. Later steps keep that setup only if the rerun succeeds. Commands that pin their own index (--index-url, --default-index, --no-index) never take this rerun.
  • Transport-failure rerun. If a host that stayed on its default later fails with a transport error (timeout, reset, DNS/TLS, 5xx/429, stalled download), the failed step reruns once through that host's mirror, after the step's own same-host attempts. A resolution or not-found error never triggers this rerun, so steps that already try one source and fall back to another behave as before. This covers install.sh install commands, setup.sh npm installs, install_python_stack.py's pip_install/pip_install_try, the Node download and the pinned uv download, plus the Windows equivalents.
  • User configuration wins. A host the user already redirected (UV_*/PIP_* index vars, an index in any pip.conf pip would read, including the Unsloth Studio venv's own, or in any uv.toml / [tool.uv] uv would read, including the project config in the current directory or its nearest parent, UNSLOTH_PYTORCH_MIRROR, UNSLOTH_TORCH_INDEX_URL, UNSLOTH_NODE_MIRROR, UNSLOTH_NPM_REGISTRY) is never touched. UNSLOTH_MIRROR_FALLBACK=0 disables the whole feature.
  • Node integrity is unchanged. install_node_prebuilt.py honours UNSLOTH_NODE_MIRROR for index.json, SHASUMS256.txt and the archive, but archives are still checked against the committed node_prebuilt_pins.json sha256 pins. A mirror therefore cannot change what gets installed.
  • Windows specifics.
    • The probes use WebRequest.GetResponseAsync, which needs no Add-Type.
    • They send a User-Agent, because CERNET answers 403 without one.
    • They pin TLS 1.2 only for the probe.
    • They raise Windows PowerShell 5.1's two-connections-per-host limit so parallel probes do not queue.
    • install.ps1 restores every variable the fallback may set when it exits, because under irm | iex they belong to the caller's session.
    • The shared block is kept in sync into setup.ps1 by scripts/sync_shared_ps1_helpers.py.

Risks and tradeoffs

  • The probe adds a few seconds before the first download, and only when a host is slow (healthy hosts return after the 1 MiB sample). A standalone unsloth studio update switches slow hosts only for its Python package downloads; its Node, npm and uv steps stay on the default hosts and fall back to a mirror only when a download fails.
  • Mirror freshness: CERNET can lag PyPI by minutes to hours. The unsynced-release rerun covers that case when pypi.org is reachable. When pypi.org is fully blocked, a release newer than the mirror cannot be installed either way.
  • The mirror block in install.sh and studio/setup.sh is byte-identical, and a test enforces it.

install_node_prebuilt.py always fetched index.json, SHASUMS256.txt and the archive from nodejs.org. UNSLOTH_NODE_MIRROR now replaces that base for every Node dist URL; archives are still verified against the sha256 pins committed in node_prebuilt_pins.json, so a mirror cannot change what gets installed.
…re blocked or slow

install.sh and studio/setup.sh now probe pypi.org, download.pytorch.org, nodejs.org and registry.npmjs.org in parallel (5 s connect, 10 s total) before the first package install. A host that fails the probe while its mirror passes is redirected through the env vars the package tools already read: PyPI to https://mirrors.cernet.edu.cn/pypi/web/simple, PyTorch wheels to UNSLOTH_PYTORCH_MIRROR=https://mirrors.cernet.edu.cn/pytorch/whl, Node.js to UNSLOTH_NODE_MIRROR=https://mirrors.cernet.edu.cn/nodejs-release, and npm to UNSLOTH_NPM_REGISTRY=https://registry.npmmirror.com.

When pypi.org still answers but misses the budget, uv gets the mirror first and pypi.org second with UV_INDEX_STRATEGY=unsafe-first-match, and pip gets the mirror as PIP_INDEX_URL with pypi.org as PIP_EXTRA_INDEX_URL, so packages the mirror has not synced yet still resolve. When pypi.org does not answer at all, only the mirror is used: unsafe-first-match fetches every index and fails outright when one is unreachable.

A host the user already redirected (UV_* / PIP_* index vars, an index in uv.toml or pip.conf, UNSLOTH_PYTORCH_MIRROR, UNSLOTH_TORCH_INDEX_URL, UNSLOTH_NODE_MIRROR, UNSLOTH_NPM_REGISTRY) is left alone, setup.sh skips the probe when install.sh already ran it, and UNSLOTH_MIRROR_FALLBACK=0 turns the fallback off.
…indows

install.ps1 and studio/setup.ps1 get the same fallback as install.sh: pypi.org, download.pytorch.org, nodejs.org and registry.npmjs.org are probed in parallel, and a host that fails while its CERNET or npmmirror counterpart passes is redirected through the same env vars (UV_*/PIP_* index vars, UNSLOTH_PYTORCH_MIRROR, UNSLOTH_NODE_MIRROR, UNSLOTH_NPM_REGISTRY), with the same slow-versus-blocked PyPI split and the same respect for indexes the user already configured.

The helpers live in the block shared with setup.ps1. The probe uses WebRequest.GetResponseAsync rather than HttpClient, which would need Add-Type, and sends a User-Agent because the CERNET mirrors answer 403 without one. On a session whose SecurityProtocol excludes TLS 1.2 it pins TLS 1.2 for the probe only. install.ps1 restores every variable the fallback may set when it exits, since under irm | iex they belong to the caller's session. setup.ps1 now computes its npm --registry args after the probe, so a fallback registry reaches every npm and bun install.
…ows when releases.astral.sh is blocked or slow
…auncher heredoc

The mirror fallback functions sat inside the quoted heredoc that writes the launcher script, so install.sh never defined them and aborted with "_mirror_fallback: not found" right before installing uv. Move the block next to its call and add a check that the block is outside every heredoc in install.sh and studio/setup.sh.
Each default package host is timed alone on a 1 MiB slice of an artifact it serves, and one below 1 MiB/s, or whose index does not answer, is raced against its mirror and swapped for it only when the mirror is faster and its own index answers. CERNET redirects each tree to a different university mirror, so each tree is timed on its own, and releases.astral.sh is timed once for both uv and its Python builds.
Ports the speed probe from install.sh to install.ps1 and studio/setup.ps1: each default host is timed alone on a 1 MiB slice of an artifact it serves, and one below 1 MiB/s, or whose index does not answer, is raced against its mirror and swapped for it only when the mirror is faster and its own index answers. Each probe uses a fresh connection and its own deadline, as a separate curl process would, and the probes raise Windows PowerShell 5.1's two-connections-per-host limit so the race's CERNET requests do not queue. The uv Python-builds mirror is dropped on Windows, where uv is always given a resolved interpreter.
…ough its mirror

The mirror probe leaves healthy defaults alone. When a later step fails because the default host stopped answering (a timeout, reset, DNS or TLS error, a 5xx/429, or a download that stalled), the installers now rerun that step once through the host's mirror, after the step's own same-host attempts. The host is read from the failure output, or from the command when a stalled download names no URL; resolution, not-found and other hosts' failures are never retried, so try-then-fallback steps keep their own fallback. A host stays on its mirror for later steps only when the rerun succeeded.

Covers install.sh's install commands, setup.sh's npm installs, install_python_stack.py's pip_install and pip_install_try, and the node and pinned uv downloads (only when no source served the file).
…iled through its mirror

The Windows mirror fallback now exports the same spare list as the POSIX installers: one mirror per probed host still on its default. install.ps1 reruns a failed package install once through that host's mirror after its own attempts, only when the output shows a transport failure on that host (or a stalled download in a command that uses the default index). A torch mirror rewrites the default torch URLs the command reads, and a mirror is kept for later steps only when the rerun succeeds. studio/setup.ps1 does the same for the frontend and OXC npm installs, and retries the Node download and the pinned uv download (the latter only when no source answered). Every install_python_stack.py run on Windows gets the same retry through the exported list.

The shared-helper sync script now also copies a new shared function that has no comment above it.
mirrors.cernet.edu.cn sends the PyPI simple index to a mirror that rate-limits uv's parallel metadata requests (429), failing resolves; tuna.mirrors.cernet.edu.cn serves the index and files from Tsinghua. The Node dist mirror moves to registry.npmmirror.com/-/binary/node, which keeps nodejs.org's layout (index.json, SHASUMS256.txt, archives), and is timed on its own tarball.
…r lacks

A switched PyPI host now uses the mirror alone, also when pypi.org was only slow: uv's unsafe-first-match fetched every package from pypi.org too, so a pypi.org that dropped mid-install failed every step. When pypi.org still answered, a failed resolve that reports a version or package as not available (a fresh release the mirror has not synced yet) reruns once with pypi.org behind the mirror, and later steps keep that setup if the rerun works. Commands that pin their own index are left alone. install_python_stack.py classifies its installs the same way.
…irror lacks

The Windows installers now match install.sh: a switched PyPI host uses the mirror alone, also when pypi.org was only slow, and when pypi.org still answered, an install whose resolve reports a version or package as not available reruns once with pypi.org behind the mirror, keeping that setup for later steps if it works. Commands that pin their own index or pass --no-index are left alone.
@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 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-09-24T09:21:16.177418Z 66a865a 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 chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 730ef53fcf

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

Comment thread install.sh Resolved
@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 730ef53fcf

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

Comment thread install.sh Resolved
…he PyPI mirror

uv reads uv.toml, or pyproject.toml with a [tool.uv] table, from the current directory or the nearest parent, and an exported UV_DEFAULT_INDEX overrides it. The mirror fallback only checked UV_CONFIG_FILE and the user and system uv.toml, so launching the installer from a project that configures its own index would redirect uv to the mirror. It now also checks the nearest project config, as install_python_stack.py's _uv_config_files does, and recognizes [[tool.uv.index]].
…ackages

setup.sh and setup.ps1 ran the mirror speed probe at startup, so every unsloth studio update, even one with nothing to install, fetched a 1 MiB sample from each default package host. The probe now runs right before the Python dependency pass and before a Transformers sidecar is rebuilt, the update steps that download from PyPI and PyTorch. install.sh and install.ps1 still probe up front and pass the result on, so fresh installs are unchanged; a standalone update's Node, npm and uv steps use the default hosts, as before the mirror fallback.
pip_install now wraps _pip_install_once with the mirror retry, and the install itself, including its _effective_requirements call, lives in _pip_install_once.
@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 670840bc90

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

Comment thread install.sh Resolved
Comment thread studio/setup.sh Resolved
…pip config

pip also reads site config from the venv it runs in (<venv>/pip.conf, pip.ini on Windows). The mirror fallback only checked PIP_CONFIG_FILE and the user and global files, so a private index set in the Unsloth Studio venv was overridden by the exported PIP_INDEX_URL whenever the install fell back from uv to pip. The check now includes the venv's site config.
The mirror retry reads a failed command's output, so the verbose install arm copied it to a log with tee. install.sh otherwise needs no tee, and on a minimal image without it the pipe closed and the command died of SIGPIPE. The arm now falls back to cat there, which only costs that host the retry. The tests that lift run_install_cmd out of install.sh also lift the functions it now calls, and stub the mirror retry.
… skip the probe on a --local re-overlay

With the probe moved to the Python dependency pass, a standalone setup reached its Node and npm downloads with no mirror retry armed. setup.sh and setup.ps1 now arm every host's one-shot mirror retry at startup without probing (_mirror_fallback spare / Invoke-MirrorFallback -SpareOnly), and still probe lazily before the first package download. setup.sh arms it from the directory its installs run in, once VENV_DIR is set, so the retry respects the same uv and pip config they do.

A --local update runs the dependency pass every time to re-overlay the checkout, almost entirely from uv's cache, so on an existing venv that pass relies on the armed retries instead of probing every host first.
@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 66a865a6c1

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

@Lyxot

Lyxot commented Sep 24, 2026

Copy link
Copy Markdown
Owner Author

Codex converged and CI finished on 66a865a6c1; results posted on unslothai#11786.

@Lyxot Lyxot closed this Sep 24, 2026
Lyxot pushed a commit that referenced this pull request Nov 16, 2026
…lt bump, H3 tiled VAE overlap (unslothai#17788)

## Summary

Three things that only make sense together:

1. MiniMax-H3-Image GGUFs (`unsloth/MiniMax-H3-Image-GGUF`) run on
stable-diffusion.cpp, so the model works on CPU, Macs, smaller GPUs and
AMD next to the existing diffusers pipeline (which needs an NVIDIA or
AMD GPU).
2. The stable-diffusion.cpp prebuilt pin moves from
`master-982-0518b34-u67cba2c` to `master-982-0518b34-u2217753`, the
release built from fork master `2217753`
(unslothai/stable-diffusion.cpp#88). The old pin has no MiniMax-H3-Image
at all, so (1) needs this bump.
3. MiniMax-H3 video passes `--vae-tile-overlap 0.25` whenever Studio
adds `--vae-tiling`, so a tiled decode uses the reference tile layout
instead of extra tiles.

## The pin bump

Fork commits between `67cba2c` and `2217753` that matter to Studio:

- MiniMax-H3-Image (leejet/stable-diffusion.cpp#2324, merged into the
fork with the release tile layout, reference sizing and edit encoding
fixes, plus computing only the PDD heads a step blends).
- MiniMax-H3 reference parity (#88): each label, timestamp and the
prompt tokenized on its own; RoPE positions in double; the simple
schedule step in double; res_multistep on the simple schedule as the H3
video default; bilinear vision resize; the reference VAE tile layout for
encode and decode; an uncompressed AVI output (`--lossless-video`,
sd-server `output_format: avi_raw`) and explicit soundtrack pairing
(`--ref-video-audio-index`).
- CPU and Wan VAE speedups and fixes (unslothai/stable-diffusion.cpp#77,
#79, #82, #83, #85, #86, #87).

Studio already gates its H3 parity features on the binary: the lossless
handoff (`sd_cpp_supports_lossless_video`, `h3_server_output_format`)
and explicit soundtrack pairing
(`sd_cpp_supports_ref_video_audio_index`) read `--help` and the server's
format list. On the old pin they stay off; on the new one they switch on
with no further Studio change.

Asset names are unchanged: the release ships the same 12 bundles plus
`sd-prebuilt-manifest.json` and `sd-prebuilt-sha256.json` as the current
pin, so the installer picks the same bundle on every host. Tests that
pin the release name and its asset list point at the new tag;
`test_sd_cpp_args.py` keeps the old pin in its list of builds that
support `--mmap`.

## The tile overlap

The H3 VAE tiler in the new build reads `--vae-tile-overlap` as the
minimum overlap fraction of its 256 px tiles and defaults to 0.5 once
`--vae-tiling` is on. The reference layout uses 64 px, which is 0.25.
Studio tiles the H3 VAE in the low VRAM memory mode (`offload_flags`
with the model policy), so that mode would have decoded more tiles than
the reference. `with_h3_vae_tile_overlap` (in `sd_cpp_args.py`) adds
`--vae-tile-overlap 0.25` to the H3 native flags whenever they contain
`--vae-tiling` and set no overlap. Every sd.cpp build accepts the flag,
so no capability gate is needed.

## MiniMax-H3-Image GGUF wiring

Backend (`studio/backend`):

- `diffusion_families.py`, MiniMax-H3-Image row:
- GGUFs are native only (`native_transformer_files_only`), the rule
MOSS-Image uses: a GGUF goes to sd.cpp on every host, the pipeline repo
stays on diffusers.
- `single_file_loadable = False`: a loose `.safetensors` DiT is still
refused on both engines, as `pipeline_only` refused it before.
- sd.cpp assets: the release image VAE (`MiniMaxAI/MiniMax-H3-Image`,
`vae/diffusion_pytorch_model.safetensors`) and the H3 Qwen3-VL-32B
encoder GGUF (`unsloth/MiniMax-H3-GGUF`,
`qwen3vl_32b_minimax_h3-Q4_K_M.gguf`), which carries the vision tower an
edit reads.
- `sd_cpp_arch_marker = "MiniMax-H3-Image"`: older builds are refused
before eviction with a clear message.
- `sd_cpp_reference = True`: `<Picture N>` edits, up to 16 pictures as
on diffusers.
- Sampler `euler` with no scheduler, shift or sigmas: sd.cpp's own
H3-Image schedule is the 6-step PDD grid.
- New `sd_cpp_rng` field, `cpu` here, so a seed renders what the model
card's `sd-cli` command renders. It reaches the sd-server spawn, every
restart and the one-shot sd-cli path.
- `diffusion.py`: the CPU / Apple Silicon refusal applies only to the
pipeline load and points at the GGUF repo; the native-only refusal names
the first upstream build per family.
- `sd_cpp_companion_only_repo_ids`: video family repos stay loadable
models, so `unsloth/MiniMax-H3-GGUF` is not hidden as an encoder-only
companion.

Frontend: a GGUF row in the MiniMax-H3-Image group (`model-catalog.ts`);
on Mac and CPU hosts the dense row is not offered
(`host-artifact-policy.ts`).

## Testing

End to end on one Colab G4 session (RTX PRO 6000 Blackwell, 96 GB, torch
2.14.1+cu130). Each arm installs sd.cpp with its own
`install_sd_cpp_prebuilt.py` (CUDA 13 bundle) and is driven through
Studio's HTTP routes. BASE = main at `fd7f6adf5b`, HEAD = this branch.

Installed builds (`--help` probe on the installed `sd-cli`):

| arm | tag | `--lossless-video` | `--ref-video-audio-index` |
`--audio-flow-shift` | `--vae-tile-overlap` |
|---|---|---|---|---|---|
| BASE | `master-982-0518b34-u67cba2c` | no | no | no | yes |
| HEAD | `master-982-0518b34-u2217753` (commit `2217753`) | yes | yes |
yes | yes |

| run | arm | result | time | peak VRAM | evidence |
|---|---|---|---|---|---|
| H3-Image GGUF `UD-Q4_K_XL`, download plan + load | BASE | refused,
HTTP 400 | 0.9 s | n/a | "'minimax-h3-image' GGUF files are not
supported yet; load its .safetensors single file instead." No download
starts. |
| same | HEAD | loaded on `sd_cpp` | 117 s (34.16 GB download included)
| n/a | plan: DiT 13.61 GB, release image VAE 2.34 GB,
`qwen3vl_32b_minimax_h3-Q4_K_M.gguf` 18.22 GB |
| text-to-image 1024x1024, 6 steps, seed 1234 | HEAD | PNG, 1.99 MB |
4.0 s | 31.6 GB | `t2i_p0.png` |
| edit (`examples/reference1.png` + `prompt.edit.txt`), 1024x1024 | HEAD
| PNG, 1.69 MB | 6.0 s | 34.0 GB | `edit_e0.png` |
| MiniMax-H3 video GGUF `UD-Q3_K_XL`, memory auto, 1344x768x124, 4 steps
| HEAD | MP4, 2.27 MB | load 59 s, render 60 s | 36.7 GB | probes
`sd_cpp_supports_lossless_video` true,
`sd_cpp_supports_ref_video_audio_index` true, `h3_server_output_format`
= `avi_raw`; the container sd.cpp handed over before the MP4 export is a
385 MB AVI with `rawvideo` + `pcm_f32le` |
| same, memory `low_vram` | HEAD | MP4, 2.22 MB | render 63 s | 20.4 GB
| sd-server argv: `--offload-to-cpu --clip-on-cpu --diffusion-fa
--vae-tiling --vae-tile-overlap 0.25 --max-vram 93.58 -v --rng cpu`;
same raw AVI handoff |

The BASE refusal needs transformers in the environment (without it BASE
stops one check earlier, on the transformers version), so the run
installs transformers 4.57.6.

Text encoder: the reference workflows use an int8 Qwen3-VL-32B encoder.
`unsloth/MiniMax-H3-GGUF` publishes only
`qwen3vl_32b_minimax_h3-Q2_K_M.gguf` (13.10 GB) and
`qwen3vl_32b_minimax_h3-Q4_K_M.gguf` (18.22 GB), no Q8_0, so Q4_K_M
stays the H3-Image default (the encoder is the reference's own 50-layer
truncation, so a stock Qwen3-VL-32B Q8_0 is not a substitute).

The H3-Image render quality numbers from the wiring run on the previous
fork branch build (L4, seed 1234, 1024x1024, 6 steps, LPIPS against bf16
sd.cpp renders on an A100): text-to-image warm 9.5 s/image (0.159 /
0.175), first request after load 110.6 s (0.165), edit 36.2 s (0.027),
low_vram first request 164.3 s (0.140); the A100 `sd-cli` render of the
same file scores 0.164 to 0.175 and 0.028 on the edit.

Unit (CPU):

- New `tests/test_sd_cpp_minimax_h3_image.py` (31 tests): routing on
cuda / cpu / mps, refusal of a build without the marker, the diffusers
GGUF refusal, the single-file refusal, asset specs, `--rng` on both
builders, the video repo staying a model, all 14 file names resolving to
the image family, the default quant pick.
- New `tests/test_h3_vae_tile_overlap.py` (8 tests): the overlap follows
`--vae-tiling` only, an explicit overlap is kept, per memory mode policy
(only the model policy tiles, with `--vae-tiling --vae-tile-overlap
0.25` adjacent), the pair survives the resident / offloaded render
choice and the host memory fit, and the H3 native loader builds its
flags through the helper.
- The sd.cpp, H3, video, MiniMax-H3 diffusion, media auto-switch and
families suites (`test_sd_cpp*`, `test_h3*`, `test_video*`,
`test_diffusion_minimax_h3*`, `test_media_auto_switch`,
`test_diffusion_more_families`): 6746 passed, 203 skipped on this
branch; 6710 passed, 203 skipped on main. The failures are the same IDs
on both:
`test_h3_ref_encode.py::test_chunked_reference_matches_stock_bit_for_bit`
(4 params), 3 in `test_video_needs_ffmpeg.py` (no ffprobe on the host)
and an error in
`test_sd_cpp_cuda_cpu_torch.py::test_selection_installs_the_cuda_build`.
4 `test_video_routes.py` generate-failure tests failed once under xdist
on this branch only and pass serially on both (87 / 87).
- Frontend: `tests/minimax-h3-image-ui.test.ts` 8 / 8,
`model-catalog.check.ts` passes, `model-catalog-network-budget` 2 / 2,
`on-device-dot-and-header-alignment` 24 / 24.

## Not covered

- Apple Silicon / Metal, Windows, ROCm and Vulkan were not run with the
new build.
- Only `UD-Q4_K_XL` of the image GGUFs ran end to end.
- The picker sizes GGUF rows by the DiT file alone; the encoder and VAE
are not counted, so on 32 GB hosts the fit badge reads optimistic.
- sd.cpp renders at the requested size, while the pipeline renders
anything under 4 MP on a 4 MP canvas, so sub-4 MP sizes differ between
the two engines.


## Screenshots

Images model picker on a CPU-only host, before and after: the
MiniMax-H3-Image pipeline row (needs CUDA or ROCm) is no longer offered
there; the MiniMax-H3-Image-GGUF row, which now runs on
stable-diffusion.cpp, is the one that loads.

![Images picker on a CPU-only host, before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17788/pr17788_ba-fe5a1a9785ec.png)
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