Skip to content

Fix MOSS-Image GGUF discovery in On Device - #15168

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
Imagineer99:fix/moss-image-local-discovery
Oct 26, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
Imagineer99:fix/moss-image-local-discovery

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Downloaded MOSS-Image GGUFs declare general.architecture = moss_image, but the inventory treated that architecture as a text model. The image picker's On Device filter consequently omitted the downloaded model even though Model Hub showed it as downloaded.

Register moss_image in the shared image architecture and family-identifying sets. Cached MOSS models now receive text-to-image when the native engine can serve them, including renamed files whose architecture is the only family hint. Existing availability checks still reject unsupported hosts.

Validation:

  • Confirmed the real downloaded MOSS-Image-SFT-UD-Q4_K_XL.gguf changes from text-generation to text-to-image in the inventory scan.
  • Linux inventory and native MOSS suites: 260 passed, 1 skipped.
  • Linux chat startup classification and non-chat GGUF preflight suites: 299 passed.
  • Native Windows MOSS inventory regressions: 14 passed.
  • Regression coverage includes SFT/Base cached rows, uppercase architecture names, renamed files, and unavailable native support.

Additional fix: renamed local MOSS-Image / Krea 2 GGUFs

With moss_image treated as a family-naming arch, the On Device listing offers a renamed MOSS-Image GGUF (for example custom/renamed-Q4_K_M.gguf) on the Images page from its header arch alone, but the loader resolved the family only from the name or tensor layout, so the same pick was refused as an undetectable family. detect_family_for_pick now falls back to the header arch for a local GGUF whose name matches no family, when that arch alone names one (krea2, moss_image). Names that match a family, or that a variant guard refused, keep their existing verdict.

Before / after

Studio built at the merge base vs this branch, both pointed at the same isolated Hugging Face cache holding two header-only moss_image GGUFs (unsloth/MOSS-Image-SFT-GGUF, unsloth/MOSS-Image-Base-GGUF).

Images page, model picker, On Device tab. Before: no rows (both repos classified text-generation). After: both MOSS-Image GGUFs listed (text-to-image).

Images On Device before and after

Chat page, model picker, On Device tab. Before: listed as chat GGUFs with a Q4_K_M quant and size, which would load into llama-server. After: listed as image models, which route to the Images page when picked.

Chat On Device before and after

@danielhanchen danielhanchen self-assigned this Oct 26, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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 ⚠️ Failed 2026-10-26T04:29:14.690201Z
We couldn’t complete this review. Comment @codex review to try again.
c4a0d90 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

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 26, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 26, 2026
@danielhanchen
danielhanchen merged commit 6f7e26e into unslothai:main Oct 26, 2026
48 of 49 checks passed
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 26, 2026
…alled one; Windows ROCm without the HIP SDK uses Vulkan (unslothai#15371)

## Summary

On Windows with an AMD GPU and a ROCm torch, loading a native
(stable-diffusion.cpp) image model such as `unsloth/MOSS-Image-SFT-GGUF`
could leave Studio with no usable sd.cpp binary at all:

1. The Unsloth mirror release `master-982-0518b34-ud331c66` publishes no
Windows ROCm asset (it ships `win-cpu`, `win-cuda12`, `win-cuda13`,
`win-vulkan`), so a ROCm request falls back to the upstream
`leejet/stable-diffusion.cpp` `win-rocm-10.1.0` zip.
2. That zip carries `amdhip64_7.dll` but its `stable-diffusion.dll`
imports `hipblas.dll`, which only the AMD HIP SDK provides. Without the
SDK on PATH, `sd-cli.exe` and `sd-server.exe` die in the Windows loader
(exit `0xC0000135`, "hipblas.dll was not found").
3. The installer extracted that bundle, swept the working Vulkan build
that was already installed as "superseded", and only then found out the
new binaries could not start. The backend removed the unrunnable copies
and the load failed with `sd-cli (stable-diffusion.cpp) binary is
unavailable`.

This PR fixes all three steps.

## Changes

`studio/install_sd_cpp_prebuilt.py`
- Before a downloaded bundle touches the managed tree, it is extracted
to a scratch directory beside the tree and its `sd-cli` / `sd-server`
are started with `--help` (bundle directory first on the library path,
loader error dialogs suppressed on Windows). If the OS loader refuses
one (Windows `0xC0000135` / `0xC0000139` / `0xC0000142`, or the POSIX
dynamic loader's "error while loading shared libraries"), the install
raises `UnrunnableBuildError` and the existing install is left exactly
as it was. Any other outcome (a normal exit, an exec error, a timeout)
is not treated as a refusal.
- CUDA bundles are not probed: they load a host or llama.cpp CUDA
runtime that the backend adds at spawn time, and the Windows cudart
archive is fetched after extraction.
- Kill switch: `UNSLOTH_SD_CPP_VERIFY_INSTALL=0` restores the previous
unverified install.
- The check runs on every OS for non-CUDA bundles. On Linux, the
upstream ROCm zip on a host without the ROCm 7 userspace is now refused
at install time (`libamdhip64.so.7` missing) and the Vulkan build is
installed, where before the ROCm build was installed and the existing
runtime ladder moved the host to Vulkan later.

`studio/backend/core/inference/sd_cpp_backend.py`
- `preferred_accelerator`: on Windows, a ROCm request starts at the
Vulkan build unless `hipblas.dll` is found in System32 or on PATH. This
is a file search only; nothing is loaded into the Studio process.
`UNSLOTH_SD_CPP_WINDOWS_ROCM=1` always takes the ROCm build (the
previous behaviour), `0` never takes it, and
`UNSLOTH_DIFFUSION_SD_CPP_VULKAN_FALLBACK=0` also keeps ROCm.
- `ensure_sd_cpp_binary` / `ensure_sd_server_binary`: when the installer
raises `UnrunnableBuildError`, the failure is recorded as proven for
that accelerator, and the next rung (rocm -> vulkan -> cpu) is installed
in the same call, so a fresh host ends up on a working build and later
loads start there. The record is keyed on the pinned tag, which the
replacement build also carries, so the record holds until the pin moves.

## MOSS-Image not listed under On Device

That part is unslothai#15168 (`moss_image` registered as an image GGUF
architecture). It merged on 2026-10-26, after `v0.1.910-beta` was tagged
(`7dbc8b9ec8`, 2026-10-23), so that release still classifies MOSS-Image
GGUFs as `text-generation`. On current main they are listed for Images.
No change is needed here.

## Testing

- New `studio/backend/tests/test_sd_cpp_install_verify.py` (14 tests).
On the merge base, 8 of them fail: the refused bundle replaces the
working build, the Windows ROCm request stays on ROCm, and a fresh ROCm
ensure returns the unrunnable build. On this branch all 14 pass. The
other 6 are guards that pass on both (kill switches, a bundle that
starts still replaces the old one, other hosts and accelerators
unchanged).
- Existing suites `test_sd_cpp_install.py`,
`test_sd_cpp_rocm_vulkan_fallback.py`,
`test_sd_cpp_vulkan_cpu_torch.py`, `test_sd_cpp_pin_upgrade.py`: 567
passed, 1 skipped on this branch.
- Real prebuilts on a Windows 11 Strix Halo (Radeon 8060S) box, with the
merge base and this branch run in the same job and HIP SDK DLLs kept off
PATH: see the results below.

Windows 11 runner (Radeon 8060S, driver DLLs `amdhip64_6.dll` /
`amdhip64_7.dll` in System32, no HIP SDK, no `hipblas.dll` anywhere on
the loader path). The merge base and this branch ran in the same job,
both with the real mirror Vulkan zip and the real upstream
`win-rocm-10.1.0` zip:

| state | ROCm install over a working Vulkan build | Vulkan binaries
left | binaries in the tree (`--help` exit) |
`preferred_accelerator("rocm")` | fresh
`ensure_sd_server_binary(accelerator="rocm")` |
|---|---|---|---|---|---|
| merge base | installed | 0 of 2 | `sd-cli.exe` 0xC0000135,
`sd-server.exe` 0xC0000135 | rocm | ROCm `sd-server.exe`, exits
0xC0000135 |
| this branch | refused (`UnrunnableBuildError`) | 2 of 2 | `sd-cli.exe`
0, `sd-server.exe` 0 | vulkan | Vulkan `sd-server.exe`, exits 0 |

On the merge base the backend's own `_server_binary_runnable` also
returns False for the swept-in server. That is the "is not runnable;
removing it so it reinstalls" path that ended the load with no binary.
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.

2 participants