Fast local LLM inference on plain CPUs. No GPU, 8 GB of RAM. OpenAI-compatible server.
Python aiavx512cpu-inferenceedge-aiggufinference-enginellama-cppllmllm-inferencelocal-ailocal-llmno-gpuon-device-aiopenai-apiopenai-compatiblequantizationqwenself-hostedspeculative-decodingternary
fix(build): stop applying patches after the first failure (#36)
Afloataaad3b584250
diff --git a/patches/apply.sh b/patches/apply.shindex db674bd..e3e5dc1 100755--- a/patches/apply.sh+++ b/patches/apply.sh@@ -25,5 +25,6 @@ cp "$here"/../kernels/ptq1-common.h "$here"/../kernels/ptq1-drop.h "$here"/../kegit -C "$src" checkout -q -- ggml/src/ggml-cpu/ggml-cpu.c ggml/src/ggml-cpu/ops.cpp src/models/qwen35.cpp \src/llama-context.cpp tools/server/server-context.cpp common/chat.h common/common.h common/arg.cpp ggml/include/ggml.h ggml/src/ggml.cfor p in "$here"/0*.patch; do- git -C "$src" apply "$p" && echo "applied: $(basename "$p")"+ git -C "$src" apply "$p"+ echo "applied: $(basename "$p")"donediff --git a/tests/test_patch_failure.py b/tests/test_patch_failure.pynew file mode 100644index 0000000..f698b75--- /dev/null+++ b/tests/test_patch_failure.py@@ -0,0 +1,43 @@+import os+from pathlib import Path+import shutil+import subprocess+import tempfile+import unittest++ROOT = Path(__file__).resolve().parents[1]+++class ApplyFailure(unittest.TestCase):+ def test_first_failed_patch_stops_the_series(self):+ with tempfile.TemporaryDirectory() as tmp:+ root = Path(tmp)+ patches, kernels, source = root / 'patches', root / 'kernels', root / 'engine'+ for path in (patches, kernels, source / 'ggml/src/ggml-cpu'):+ path.mkdir(parents=True)+ shutil.copyfile(ROOT / 'patches/apply.sh', patches / 'apply.sh')+ for name in ('ptq1-common.h', 'ptq1-drop.h', 'ptq1-fast.inc', 'ptq1-panel.inc',+ 'ptq1-vbmi.inc', 'x1-q4k.inc', 'attn-fast.inc', 'kvq.h'):+ (kernels / name).touch()+ paths = ('ggml/src/ggml-cpu/ggml-cpu.c', 'ggml/src/ggml-cpu/ops.cpp',+ 'src/models/qwen35.cpp', 'src/llama-context.cpp', 'tools/server/server-context.cpp',+ 'common/chat.h', 'common/common.h', 'common/arg.cpp', 'ggml/include/ggml.h', 'ggml/src/ggml.c')+ for name in paths:+ file = source / name+ file.parent.mkdir(parents=True, exist_ok=True)+ file.write_text('original\n')+ subprocess.run(['git', 'init', '-q', str(source)], check=True)+ subprocess.run(['git', '-C', str(source), 'add', '.'], check=True)+ subprocess.run(['git', '-C', str(source), '-c', 'user.name=Fixture', '-c',+ '[email protected]', 'commit', '-qm', 'fixture'], check=True)+ (patches / '0001-invalid.patch').write_text('not a patch\n')+ (patches / '0002-next.patch').write_text('diff --git a/common/chat.h b/common/chat.h\n'+ '--- a/common/chat.h\n+++ b/common/chat.h\n@@ -1 +1 @@\n-original\n+changed\n')+ result = subprocess.run(['sh', str(patches / 'apply.sh'), str(source)], capture_output=True, text=True)+ self.assertNotEqual(result.returncode, 0, result.stdout)+ self.assertEqual((source / 'common/chat.h').read_text(), 'original\n')+ self.assertNotIn('applied: 0002', result.stdout)+++if __name__ == '__main__':+ unittest.main()