Add separate image and text Decision Router nodes with configurable system prompts, up to 52 user-defined routes, per-item decisions, normalized decision_json output, and native IMAGE/STRING route sockets. Run Clef-Flash 9B, Clef 27B, and OpenJev 27B in-process through llama.cpp. Add decision-head, logits, MTMD vision, and dynamic CUDA backend capability checks before model downloads. Keep model weights and vision projectors out of the repository; do not launch a separate llama-server or upgrade PyTorch/Transformers. Block inactive route outputs so unused downstream branches are skipped. Keep dynamic route names synchronized with connected outputs and preserve stable socket identities. Register the commercial UI variant while keeping non-commercial OpenJev unavailable in commercial builds. Update all 3.0.0 package metadata, README, runtime and workflow guides, the illustrated router example, and the detailed update log. Refresh regression expectations for commercial router registration and the current provider model catalog. Validation: all 220 tests pass in the bundled ComfyUI Python 3.12 runtime. Python compilation, JavaScript syntax, version metadata, README image, and staged diff checks pass. The Image Router was manually exercised with Clef-Flash 9B on fox, dog, cat, and none routes. Coverage limits: full-weight inference for Clef 27B and OpenJev 27B, text-mode smoke tests, and clean installs across other OS/Python/CUDA combinations remain unverified. The documented Windows x64, CPython 3.12, CUDA 13.0 JamePeng runtime is the only verified build matrix.
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
import ctypes
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
from types import SimpleNamespace
|
|
from unittest import mock
|
|
|
|
PACKAGE_ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(PACKAGE_ROOT))
|
|
|
|
import AILab_LlamaCppInstaller as installer
|
|
|
|
|
|
class LlamaCppInstallerTests(unittest.TestCase):
|
|
def test_gpu_probe_registers_dynamic_backends_before_checking_offload(self):
|
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
package_dir = Path(temp_dir) / "llama_cpp"
|
|
backend_dir = package_dir / "lib"
|
|
backend_dir.mkdir(parents=True)
|
|
package_file = package_dir / "__init__.py"
|
|
package_file.touch()
|
|
|
|
supports_gpu = mock.Mock(return_value=True)
|
|
low_level = SimpleNamespace(_lib=None, llama_supports_gpu_offload=supports_gpu)
|
|
load_backends = mock.Mock()
|
|
ggml = SimpleNamespace(ggml_backend_load_all_from_path=load_backends)
|
|
modules = {
|
|
"llama_cpp.llama_cpp": low_level,
|
|
"llama_cpp": SimpleNamespace(__file__=str(package_file)),
|
|
"llama_cpp._ggml": ggml,
|
|
}
|
|
|
|
with mock.patch.object(installer.importlib, "import_module", side_effect=modules.__getitem__):
|
|
self.assertTrue(installer._probe_gpu_offload_support())
|
|
|
|
load_backends.assert_called_once()
|
|
self.assertIsInstance(load_backends.call_args.args[0], ctypes.c_char_p)
|
|
self.assertEqual(load_backends.call_args.args[0].value, os.fsencode(backend_dir))
|
|
supports_gpu.assert_called_once_with()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|