feat(loaders): make gguf a FunPack requirement

A fresh install now reads .gguf with nothing extra. The no-backend message
points at re-running requirements rather than naming a lone package.
This commit is contained in:
digital-garbage
2026-08-22 23:27:48 +03:00
parent 9af45cf695
commit c55d22752a
3 changed files with 22 additions and 5 deletions
+6 -3
View File
@@ -190,9 +190,12 @@ def backend() -> Optional[str]:
UNAVAILABLE = (
"No GGUF backend is available. Either install ComfyUI-GGUF (custom node pack — keeps the "
"weights quantized in VRAM, which is the point of GGUF), or `pip install gguf` into "
"ComfyUI's environment for a load-time dequantize that works but gives back no memory."
"No GGUF backend is available. The `gguf` package is one of FunPack's requirements, so an "
"install that predates .gguf support just needs them re-run:\n"
" pip install -r custom_nodes/ComfyUI-FunPack/requirements.txt\n"
"That gives a load-time dequantize: the file loads, but at its full size. To keep the "
"weights quantized in VRAM — which is the point of GGUF — install the ComfyUI-GGUF node "
"pack as well; FunPack uses it as the runtime and stays the only loader you wire."
)
+3
View File
@@ -2,6 +2,9 @@ transformers>=5.0.0
huggingface_hub
safetensors
numpy
# Reads .gguf containers in the FunPack loaders. Pure python + numpy; it does not
# pull CUDA or any model. Without it a .gguf needs the ComfyUI-GGUF node pack instead.
gguf
Pillow
insightface
opencv-python-headless
+13 -2
View File
@@ -74,9 +74,11 @@ def test_no_backend_refuses_with_both_remedies(monkeypatch):
with pytest.raises(RuntimeError) as e:
gguf_support.load_state_dict("/nope.gguf")
msg = str(e.value)
# Both ways out must be named: they have different consequences for VRAM.
# Both ways out must be named: they have different consequences for VRAM. `gguf` is a
# FunPack requirement now, so the first is a re-run of them rather than a lone package.
assert "ComfyUI-GGUF" in msg
assert "pip install gguf" in msg
assert "requirements.txt" in msg
assert "quantized in VRAM" in msg
def test_the_pack_wins_when_both_are_available(monkeypatch):
@@ -229,3 +231,12 @@ def test_a_pack_refusal_without_the_library_still_raises(tmp_path, monkeypatch):
monkeypatch.setattr(gguf_support.importlib.util, "find_spec", lambda name: None)
with pytest.raises(ValueError, match="nope"):
gguf_support.load_state_dict("/h3.gguf")
def test_gguf_is_a_declared_requirement():
"""The advice in UNAVAILABLE is "re-run FunPack's requirements", which is only true
while gguf is actually in them."""
import pathlib
reqs = pathlib.Path("requirements.txt").read_text(encoding="utf-8")
lines = [ln.strip() for ln in reqs.splitlines() if ln.strip() and not ln.startswith("#")]
assert any(ln == "gguf" or ln.startswith("gguf") for ln in lines)