Skip to content

[Other] setup: reuse shared vision projectors above local GGUF directories - #503

Open
zerodegress wants to merge 4 commits into
simplexai-labs:mainfrom
zerodegress:fix/qwen4-mmproj-parent
Open

zerodegress wants to merge 4 commits into
simplexai-labs:mainfrom
zerodegress:fix/qwen4-mmproj-parent

Conversation

@zerodegress

@zerodegress zerodegress commented Dec 6, 2026 •

Copy link
Copy Markdown

Problem and result

With vision enabled, a local model can have one projector beside several quantization directories. Pointing --gguf-dir at a quantization directory made Qwen4 and Qwen3.6 Strata report a missing projector. The Poly installer could request another download. All three paths now reuse a matching shared file.

For example, setup can read mmproj-BF16.gguf beside UD-IQ2_XS/ when that directory contains both Qwen4-35B-A3B shards.

Related discussion

None found.

Approach

Use the existing mmproj_beside fallback after each installer's existing local choices. Poly keeps its managed cache priority and uses the size-specific pin when available. During verification, setup temporarily registers the shared projector’s directory so the checksum mark stays under PolyStrata’s marks/ directory. The registration is removed even if verification fails. The existing custom-file rules and vision-off behavior remain in place.

Validation

Linux x86_64, Python 3.14.10, commit d52374653e59 based on 7cef9524.

Passed

  • python -B terminal/tools/test_setup_qwen36.py — 29 passed. Covers both Strata and Poly, including cache precedence, file ownership and fallback when the shared file is truncated.
  • python -B terminal/tools/test_setup_qwen4.py — 14 passed, 1 skipped. The new CLI test passes only --custom-gguf for model selection and checks automatic Qwen4 detection, the saved model and parent projector paths, and zero downloads. Checks the saved projector path and absence of a projector download.
  • python -B terminal/tools/test_setup_custom_gguf.py — 21 passed.
  • python -B terminal/tools/test_setup_feed_models.py — 37 passed.
  • Local Qwen4-35B-A3B UD-IQ2_XS files with the setup harness. The parent projector matched the catalog size (902,822,144 bytes) and SHA-256 independently. Setup selected it without requesting a projector download. The checksum mark appeared only in the temporary setup marks directory.
Local validation command (model location generalized)
PYTHONPATH=terminal/tools python -B - <<'PY'
from test_setup_qwen4 import InstallQwen4OnStrataPoly, setup
from pathlib import Path
import hashlib, json, tempfile
folder = next(Path.home().glob("models/*/Qwen4-35B-A3B-Q8_0-ngram-GGUF/UD-IQ2_XS"))
fam = setup.QWEN4_FAMILIES["qwen4"]
p = folder.parent / fam["mmproj"]
assert not (folder / p.name).exists()
with p.open("rb") as f:
    assert (p.stat().st_size, hashlib.file_digest(f, "sha256").hexdigest()) == fam["sha256"][p.name]
with tempfile.TemporaryDirectory() as d:
    t = Path(d)
    case = InstallQwen4OnStrataPoly()
    a = case._base_args(t, model=folder.name, gguf_dir=str(folder), mtp="off")
    from unittest.mock import patch
    real = setup.verify_sha256
    def verify(path, *args, **kwargs):
        if path == p:
            real(path, *args, **kwargs)
    with patch.object(setup, 'ROOT', t):
        setup.own_files_in(folder)
        rc, _, _, _, downloads = case._run_install(t, a, verify=verify)
        assert setup._kept_mark(p).read_text() == 'sha256 ' + fam['sha256'][p.name][1]
        assert not p.with_name(p.name + '.done').exists()
        assert not setup._is_own_file(p)
        print('PASS: internal mark only, parent registration removed')
    cfg = json.loads((t / "strata-qwen4-ud-iq2_xs.json").read_text())
    assert rc == 0 and Path(cfg["vision"]["mmproj"]) == p
    assert not any(dst.name == p.name for _, dst in downloads)
    print("PASS: parent projector, pinned size and SHA-256, no projector download")
PY

Failed

None on the submitted revision. The CLI regression test reproduced the missing-projector exit when run with the original install_qwen4 function from 7cef9524. On e92e232c1fc2, enabling real projector verification in the Qwen4 and Qwen3.6 Strata tests reproduced an unwanted .done beside the shared file. Before each fix, the new regression tests reproduced the missing-projector exit on Qwen4 and Qwen3.6 Strata. The Poly test observed the managed download path instead of the existing parent file.

Not run

The opt-in live Hugging Face revision check was skipped. No engine code changed. Setup tests mock engine builds, subprocesses and downloads. The local Qwen4 harness mocks shard checks and runs real SHA-256 verification for the projector. No GPU inference or end-to-end LocalAI launch was run.

Limits

Shared files must match the pinned name and size. The search covers the parent and its models/ subdirectory only. Qwen3.6 exercises the common Poly installer in tests. Other Poly families were not tested with real weights.

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