knurlogic 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- knurlogic-0.1.0/LICENSE +202 -0
- knurlogic-0.1.0/NOTICE +44 -0
- knurlogic-0.1.0/PKG-INFO +178 -0
- knurlogic-0.1.0/README.md +142 -0
- knurlogic-0.1.0/pyproject.toml +149 -0
- knurlogic-0.1.0/setup.cfg +4 -0
- knurlogic-0.1.0/src/knurlogic/__init__.py +50 -0
- knurlogic-0.1.0/src/knurlogic/__main__.py +4 -0
- knurlogic-0.1.0/src/knurlogic/cluster/__init__.py +23 -0
- knurlogic-0.1.0/src/knurlogic/cluster/checks.py +185 -0
- knurlogic-0.1.0/src/knurlogic/cluster/discovery.py +333 -0
- knurlogic-0.1.0/src/knurlogic/cluster/jobs.py +371 -0
- knurlogic-0.1.0/src/knurlogic/cluster/launch.py +1957 -0
- knurlogic-0.1.0/src/knurlogic/cluster/links.py +227 -0
- knurlogic-0.1.0/src/knurlogic/cluster/peers.py +584 -0
- knurlogic-0.1.0/src/knurlogic/cluster/protocol.py +360 -0
- knurlogic-0.1.0/src/knurlogic/cluster/recovery.py +739 -0
- knurlogic-0.1.0/src/knurlogic/cluster/transport.py +266 -0
- knurlogic-0.1.0/src/knurlogic/context_management/__init__.py +13 -0
- knurlogic-0.1.0/src/knurlogic/context_management/compaction.py +225 -0
- knurlogic-0.1.0/src/knurlogic/context_management/context_edits.py +418 -0
- knurlogic-0.1.0/src/knurlogic/context_management/prompts/compact.md +14 -0
- knurlogic-0.1.0/src/knurlogic/context_management/prompts/findings.md +4 -0
- knurlogic-0.1.0/src/knurlogic/engine/__init__.py +12 -0
- knurlogic-0.1.0/src/knurlogic/engine/arch.py +210 -0
- knurlogic-0.1.0/src/knurlogic/engine/crosschip.py +120 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/__init__.py +86 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/deepseek/__init__.py +27 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/deepseek/architecture/PROVENANCE.md +106 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/deepseek/architecture/THIRD-PARTY.md +37 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/deepseek/architecture/__init__.py +6 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/deepseek/architecture/deepseek_v4.py +2925 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/deepseek/architecture/pins.json +1 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/__init__.py +39 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/architecture/PROVENANCE.md +41 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/architecture/THIRD-PARTY.md +51 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/architecture/__init__.py +5 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/architecture/gemma4.py +96 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/architecture/gemma4_text.py +742 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/architecture/pins.json +15 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/vision/PROVENANCE.md +131 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/vision/__init__.py +296 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/vision/config.py +44 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/gemma4/vision/vision.py +395 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/__init__.py +78 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/PROVENANCE.md +28 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/THIRD-PARTY.md +51 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/__init__.py +7 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/__init__.py +21 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/__init__.py +0 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/kv_quant.py +186 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/__init__.py +0 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/activations.py +40 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/base.py +605 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/cache.py +2788 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/deepseek_v32/__init__.py +0 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/deepseek_v32/config.py +40 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/deepseek_v32/language.py +627 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/deepseek_v4/__init__.py +0 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/deepseek_v4/hyper_connection.py +285 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/gated_delta.py +300 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/mla.py +82 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/mlp.py +68 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/rope_utils.py +1505 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/models/switch_layers.py +228 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/_mlx_vlm/turboquant.py +6607 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/config.py +138 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/glm5_next.py +156 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/language.py +823 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/glm5_next/vision.py +357 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/architecture/pins.json +9 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/heads/__init__.py +1 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/heads/glm5.py +229 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/vision/PROVENANCE.md +62 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/glm5/vision/__init__.py +232 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/__init__.py +138 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/PROVENANCE.md +31 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/THIRD-PARTY.md +52 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/__init__.py +6 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/pins.json +23 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/qwen3_5.py +726 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/qwen3_5_moe.py +52 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/architecture/qwen4_exp.py +1374 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/heads/__init__.py +2 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/heads/qwen35.py +270 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/heads/qwen4_exp.py +240 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/kvcache.py +102 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/vision/PROVENANCE.md +40 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/vision/__init__.py +27 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/vision/family.py +230 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/vision/processing.py +283 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/vision/rope_index.py +61 -0
- knurlogic-0.1.0/src/knurlogic/engine/families/qwen/vision/vision.py +497 -0
- knurlogic-0.1.0/src/knurlogic/engine/kvattn.py +338 -0
- knurlogic-0.1.0/src/knurlogic/engine/kvquant.py +468 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/__init__.py +32 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/_artifacts.py +210 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/batch_generator.py +693 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/batch_loop.py +930 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/caches.py +162 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/capture.py +65 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/registry.py +146 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/sampling.py +189 -0
- knurlogic-0.1.0/src/knurlogic/engine/mtp/seed.py +58 -0
- knurlogic-0.1.0/src/knurlogic/engine/register.py +135 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/PROVENANCE.md +38 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/__init__.py +3 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/executor.py +186 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/host.py +289 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/pipeline.py +505 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/plan.py +181 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/prompt.py +348 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/request.py +267 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/scheduler.py +1211 -0
- knurlogic-0.1.0/src/knurlogic/engine/runtime/tensor.py +899 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/__init__.py +46 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/cache_report.py +36 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/drafting.py +62 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/load.py +373 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/segments.py +44 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/state.py +26 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/thinking.py +330 -0
- knurlogic-0.1.0/src/knurlogic/engine/serve/vision.py +85 -0
- knurlogic-0.1.0/src/knurlogic/engine/smoke.py +152 -0
- knurlogic-0.1.0/src/knurlogic/engine/templates/PROVENANCE.md +43 -0
- knurlogic-0.1.0/src/knurlogic/engine/templates/__init__.py +161 -0
- knurlogic-0.1.0/src/knurlogic/engine/templates/deepseek_v4.jinja +166 -0
- knurlogic-0.1.0/src/knurlogic/engine/vendor.py +145 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/__init__.py +254 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/_base.py +72 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/cachehook.py +214 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/images.py +162 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/key.py +181 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/quant.py +51 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/registry.py +100 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/request.py +301 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/scatter.py +72 -0
- knurlogic-0.1.0/src/knurlogic/engine/vision/store.py +208 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/__init__.py +15 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/cli.py +62 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/connect.py +202 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/doctor.py +180 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/drafting.py +89 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/__init__.py +228 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/messages.py +506 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/ollama.py +326 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/openai.py +394 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/residency.py +126 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/responses.py +401 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/http/server.py +699 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/loading.py +120 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/mcp.py +1025 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/menubar.py +182 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/menubar_assets/gear.png +0 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/menubar_assets/gear@2x.png +0 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/__init__.py +7 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/api.js +25 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/app.js +58 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/format.js +14 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/index.html +194 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/nodes.js +42 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/page.css +835 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/ui/overlay.js +60 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/bench.js +227 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/chat.js +875 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/connect.js +94 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/downloads.js +47 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/home.js +342 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/logo.js +41 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/memory.js +221 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/picker.js +807 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/apply.js +144 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/cluster.js +133 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/index.js +69 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/keep.js +4 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/knobs.js +160 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/knurlogic.js +170 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/assets/views/settings/models.js +150 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/documents.py +811 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/hub.py +323 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/server.py +2089 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/page/updates.py +118 -0
- knurlogic-0.1.0/src/knurlogic/interfaces/serve.py +860 -0
- knurlogic-0.1.0/src/knurlogic/machine/__init__.py +16 -0
- knurlogic-0.1.0/src/knurlogic/machine/allowance.py +65 -0
- knurlogic-0.1.0/src/knurlogic/machine/artifact.py +420 -0
- knurlogic-0.1.0/src/knurlogic/machine/deps.py +181 -0
- knurlogic-0.1.0/src/knurlogic/machine/discover.py +426 -0
- knurlogic-0.1.0/src/knurlogic/machine/identity.py +90 -0
- knurlogic-0.1.0/src/knurlogic/machine/loaded.py +653 -0
- knurlogic-0.1.0/src/knurlogic/machine/loadlock.py +133 -0
- knurlogic-0.1.0/src/knurlogic/machine/metrics.py +245 -0
- knurlogic-0.1.0/src/knurlogic/machine/preferences.py +126 -0
- knurlogic-0.1.0/src/knurlogic/machine/servers.py +156 -0
- knurlogic-0.1.0/src/knurlogic/machine/status.py +261 -0
- knurlogic-0.1.0/src/knurlogic/machine/strategy.py +53 -0
- knurlogic-0.1.0/src/knurlogic/machine/wired.py +358 -0
- knurlogic-0.1.0/src/knurlogic/tuning/__init__.py +11 -0
- knurlogic-0.1.0/src/knurlogic/tuning/resolve.py +1476 -0
- knurlogic-0.1.0/src/knurlogic/tuning/settings.py +1209 -0
- knurlogic-0.1.0/src/knurlogic.egg-info/PKG-INFO +178 -0
- knurlogic-0.1.0/src/knurlogic.egg-info/SOURCES.txt +204 -0
- knurlogic-0.1.0/src/knurlogic.egg-info/dependency_links.txt +1 -0
- knurlogic-0.1.0/src/knurlogic.egg-info/entry_points.txt +2 -0
- knurlogic-0.1.0/src/knurlogic.egg-info/requires.txt +15 -0
- knurlogic-0.1.0/src/knurlogic.egg-info/top_level.txt +1 -0
knurlogic-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
knurlogic-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
knurlogic
|
|
2
|
+
Copyright 2026 Noah Zelezny
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (LICENSE).
|
|
5
|
+
|
|
6
|
+
This product includes software developed by other projects, vendored under
|
|
7
|
+
their own licenses. Each folder that carries vendored source records it in
|
|
8
|
+
a THIRD-PARTY.md (license) and PROVENANCE.md (origin, version, digest).
|
|
9
|
+
|
|
10
|
+
mlx-lm (https://github.com/ml-explore/mlx-lm)
|
|
11
|
+
MIT License, Copyright (c) 2023-2026 Apple Inc.
|
|
12
|
+
Model architectures in src/knurlogic/engine/families/qwen/architecture/
|
|
13
|
+
(qwen3_5.py, qwen3_5_moe.py; qwen4_exp.py via the mlx-lm fork at
|
|
14
|
+
https://github.com/eauchs/mlx-lm) and
|
|
15
|
+
src/knurlogic/engine/families/gemma4/architecture/ (gemma4.py,
|
|
16
|
+
gemma4_text.py).
|
|
17
|
+
|
|
18
|
+
mlx-lm fork (the knurlogic author's own)
|
|
19
|
+
MIT License, Copyright (c) 2023-2025 Apple Inc.; changes by Noah Zelezny
|
|
20
|
+
src/knurlogic/engine/families/deepseek/architecture/deepseek_v4.py
|
|
21
|
+
|
|
22
|
+
mlx-vlm (https://github.com/Blaizzy/mlx-vlm)
|
|
23
|
+
MIT License, Copyright (c) 2025 Prince Canuma
|
|
24
|
+
src/knurlogic/engine/families/glm5/architecture/glm5_next/ and the
|
|
25
|
+
vision towers in src/knurlogic/engine/families/{qwen,gemma4}/vision/.
|
|
26
|
+
hyper_connection.py (glm5_next/_mlx_vlm/models/deepseek_v4/):
|
|
27
|
+
MIT License, Copyright (c) 2026 Apple Inc.
|
|
28
|
+
|
|
29
|
+
DeepSeek-V4 chat encoding
|
|
30
|
+
(https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash)
|
|
31
|
+
MIT License, Copyright (c) 2023 DeepSeek
|
|
32
|
+
src/knurlogic/engine/templates/deepseek_v4.jinja (a Jinja port) and
|
|
33
|
+
tests/fixtures_deepseek_v4/ (the encoder and its golden outputs).
|
|
34
|
+
|
|
35
|
+
vqlab (https://github.com/noahzelezny/VQLab)
|
|
36
|
+
Apache License 2.0, Copyright 2026 Noah Zelezny
|
|
37
|
+
src/knurlogic/engine/families/glm5/heads/glm5.py and the snapshot caches
|
|
38
|
+
in src/knurlogic/engine/mtp/caches.py.
|
|
39
|
+
|
|
40
|
+
exo fork (https://github.com/noahzelezny/exo)
|
|
41
|
+
Apache License 2.0; the ported code is the knurlogic author's own
|
|
42
|
+
src/knurlogic/engine/mtp/batch_generator.py: ported from the maintainer's
|
|
43
|
+
own code in github.com/noahzelezny/exo (generator/mtp_batch_generate.py),
|
|
44
|
+
Apache-2.0. It contains no code from upstream exo.
|
knurlogic-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: knurlogic
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Serve local language models on Apple Silicon, for people and agents.
|
|
5
|
+
Author: Noah Zelezny
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/noahzelezny/Knurlogic
|
|
8
|
+
Project-URL: Repository, https://github.com/noahzelezny/Knurlogic
|
|
9
|
+
Project-URL: Issues, https://github.com/noahzelezny/Knurlogic/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/noahzelezny/Knurlogic/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: mlx,apple-silicon,llm,inference,openai,anthropic,mcp,local-models
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: MacOS X
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: NOTICE
|
|
25
|
+
Requires-Dist: mlx==0.31.2; platform_system == "Darwin"
|
|
26
|
+
Requires-Dist: mlx-lm==0.31.3
|
|
27
|
+
Requires-Dist: huggingface_hub>=0.24
|
|
28
|
+
Requires-Dist: numpy>=1.24
|
|
29
|
+
Requires-Dist: Pillow>=10.0
|
|
30
|
+
Requires-Dist: rumps>=0.4; sys_platform == "darwin"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# Knurlogic
|
|
38
|
+
|
|
39
|
+
Knurlogic serves local language models on Apple Silicon. It works out the
|
|
40
|
+
settings a model needs and whether it fits in memory before loading it,
|
|
41
|
+
then runs it behind an OpenAI- and Anthropic-compatible server. People use
|
|
42
|
+
it through a web page; agents use it through an MCP server. One model can
|
|
43
|
+
also be split across two or more Macs.
|
|
44
|
+
|
|
45
|
+
## Requirements
|
|
46
|
+
|
|
47
|
+
* A Mac with Apple Silicon and enough unified memory for the model.
|
|
48
|
+
* Python 3.10 or newer.
|
|
49
|
+
* mlx 0.31.2 and mlx-lm 0.31.3, pinned exactly (pip installs them).
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
pip install knurlogic
|
|
54
|
+
|
|
55
|
+
From source:
|
|
56
|
+
|
|
57
|
+
git clone https://github.com/noahzelezny/Knurlogic
|
|
58
|
+
cd Knurlogic && pip install -e .
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
Get a model in MLX format: search and download it from the page's model
|
|
63
|
+
picker (Hugging Face), or with the `hf` CLI that comes with
|
|
64
|
+
`huggingface_hub`:
|
|
65
|
+
|
|
66
|
+
pip install -U huggingface_hub
|
|
67
|
+
hf download mlx-community/gemma-4-e4b-it-8bit \
|
|
68
|
+
--local-dir ~/Knurlogic/Models/gemma-4-e4b-it-8bit
|
|
69
|
+
|
|
70
|
+
`knurlogic models` lists the models already on this Mac (Knurlogic's own
|
|
71
|
+
folder, the Hugging Face cache, LM Studio, Ollama and exo folders).
|
|
72
|
+
|
|
73
|
+
Check it and serve it:
|
|
74
|
+
|
|
75
|
+
knurlogic doctor ~/Knurlogic/Models/gemma-4-e4b-it-8bit
|
|
76
|
+
knurlogic serve ~/Knurlogic/Models/gemma-4-e4b-it-8bit
|
|
77
|
+
|
|
78
|
+
Then ask it something:
|
|
79
|
+
|
|
80
|
+
curl http://127.0.0.1:8080/v1/chat/completions \
|
|
81
|
+
-H 'Content-Type: application/json' \
|
|
82
|
+
-d '{"model": "local", "messages": [{"role": "user", "content": "Hello"}]}'
|
|
83
|
+
|
|
84
|
+
The page is at http://127.0.0.1:8080/: what is loaded, where the memory
|
|
85
|
+
went, a chat and the settings. `knurlogic ui` opens the page at
|
|
86
|
+
http://127.0.0.1:8899/ without loading anything, with a Launch button for
|
|
87
|
+
every model on the disk, and a gear in the macOS menu bar (`--no-menubar`
|
|
88
|
+
skips it) that shows what is loaded and opens or quits the page.
|
|
89
|
+
|
|
90
|
+
## Connect a harness
|
|
91
|
+
|
|
92
|
+
`knurlogic connect --port 8080` prints these for a running server.
|
|
93
|
+
|
|
94
|
+
**Claude Code** (or any Anthropic Messages client):
|
|
95
|
+
|
|
96
|
+
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 \
|
|
97
|
+
ANTHROPIC_API_KEY=x \
|
|
98
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL=local \
|
|
99
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL=local \
|
|
100
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL=local \
|
|
101
|
+
API_TIMEOUT_MS=3000000 \
|
|
102
|
+
claude
|
|
103
|
+
|
|
104
|
+
**OpenAI-compatible clients** (Zed, Cline, Continue, Open WebUI): base URL
|
|
105
|
+
`http://127.0.0.1:8080/v1`, any API key, model `local`.
|
|
106
|
+
|
|
107
|
+
**Responses-API clients** (the OpenAI SDK's `client.responses`, Codex-style
|
|
108
|
+
tools): the same base URL; `POST /v1/responses` with function tools,
|
|
109
|
+
streaming and reasoning summaries. `previous_response_id` and `store: true`
|
|
110
|
+
are refused: the server keeps no conversation, so resend the input.
|
|
111
|
+
|
|
112
|
+
**Ollama clients** (Open WebUI's Ollama mode, Continue, the `ollama`
|
|
113
|
+
libraries): `OLLAMA_HOST=http://127.0.0.1:8080`. `/api/chat`, `/api/generate`
|
|
114
|
+
(streaming NDJSON by default), `/api/tags`, `/api/show` and `/api/version`
|
|
115
|
+
are served, with images in chat messages on a vision model.
|
|
116
|
+
|
|
117
|
+
**MCP**, for an agent that should manage models rather than talk to one:
|
|
118
|
+
|
|
119
|
+
claude mcp add knurlogic -- knurlogic mcp
|
|
120
|
+
|
|
121
|
+
Its tools are `models`, `fit`, `settings`, `drafting`, `ready`, `load`,
|
|
122
|
+
`state`, `unload` and `deps`; `knurlogic mcp --list` describes each.
|
|
123
|
+
`load` refuses a model that does not fit.
|
|
124
|
+
|
|
125
|
+
## Two or more Macs
|
|
126
|
+
|
|
127
|
+
To split one model across two or more Macs (up to 16) joined by Thunderbolt,
|
|
128
|
+
install the same
|
|
129
|
+
knurlogic version and the model on both, and run on each:
|
|
130
|
+
|
|
131
|
+
knurlogic ui --host cluster
|
|
132
|
+
|
|
133
|
+
The Macs find each other over Bonjour (`--peer HOST` names one directly, on each machine
|
|
134
|
+
(or link them with Thunderbolt);
|
|
135
|
+
`knurlogic doctor --cluster` says what is in the way). Then launch the
|
|
136
|
+
model from the page with the machines selected, or with the MCP `load`
|
|
137
|
+
tool's `machines` argument. The TCP ring works for any number of Macs;
|
|
138
|
+
RDMA (jaccl) needs every pair cabled with Thunderbolt 5, and beyond two
|
|
139
|
+
Macs it is experimental and untested.
|
|
140
|
+
|
|
141
|
+
## Settings
|
|
142
|
+
|
|
143
|
+
Every setting is resolved from the model's `config.json` and the memory
|
|
144
|
+
available, and shown in the page's Settings panel and at `/settings.json`.
|
|
145
|
+
Two presets cover most needs: `default` (fastest) and `lean` (more
|
|
146
|
+
context in less memory: 512-token prompt chunks, MTP off, 8-bit KV).
|
|
147
|
+
`serve --tune default|lean` picks one, `--kv-bits 8` stores the KV cache
|
|
148
|
+
in about half the memory, and `--set KEY=VALUE` overrides any single
|
|
149
|
+
setting. A context length past the model's native window turns on YaRN
|
|
150
|
+
for the Qwen families (up to 1,048,576 tokens).
|
|
151
|
+
|
|
152
|
+
## Supported models
|
|
153
|
+
|
|
154
|
+
| Family | `model_type` | Vision | Drafting (MTP) | 8-bit KV |
|
|
155
|
+
|---|---|---|---|---|
|
|
156
|
+
| Qwen 3.5 / 3.6 | `qwen3_5`, `qwen3_5_moe` | yes | if the model has a head | yes |
|
|
157
|
+
| Qwen 3.8 | `qwen4_exp` | yes | if the model has a head | yes |
|
|
158
|
+
| Gemma 4 | `gemma4`, `gemma4_text` | yes | no | yes |
|
|
159
|
+
| GLM-5 | `glm5_next` | yes | if the model has a head | yes |
|
|
160
|
+
| DeepSeek-V4 | `deepseek_v4` | no | no | no |
|
|
161
|
+
|
|
162
|
+
VQ-quantized models (published with their own `model.py`) are supported
|
|
163
|
+
for these families; each runs the `model.py` it ships. The page tags a
|
|
164
|
+
Hugging Face model "update" when the Hub has a newer revision (checked once
|
|
165
|
+
at start; `knurlogic ui --offline` or `HF_HUB_OFFLINE=1` skips it).
|
|
166
|
+
|
|
167
|
+
## Code
|
|
168
|
+
|
|
169
|
+
How the package is laid out and who may import whom: [docs/architecture.md](docs/architecture.md).
|
|
170
|
+
|
|
171
|
+
## Status
|
|
172
|
+
|
|
173
|
+
Alpha. Expect rough edges and breaking changes before 1.0; see
|
|
174
|
+
CHANGELOG.md.
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
Apache-2.0. Vendored third-party code is listed in NOTICE.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Knurlogic
|
|
2
|
+
|
|
3
|
+
Knurlogic serves local language models on Apple Silicon. It works out the
|
|
4
|
+
settings a model needs and whether it fits in memory before loading it,
|
|
5
|
+
then runs it behind an OpenAI- and Anthropic-compatible server. People use
|
|
6
|
+
it through a web page; agents use it through an MCP server. One model can
|
|
7
|
+
also be split across two or more Macs.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
* A Mac with Apple Silicon and enough unified memory for the model.
|
|
12
|
+
* Python 3.10 or newer.
|
|
13
|
+
* mlx 0.31.2 and mlx-lm 0.31.3, pinned exactly (pip installs them).
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
pip install knurlogic
|
|
18
|
+
|
|
19
|
+
From source:
|
|
20
|
+
|
|
21
|
+
git clone https://github.com/noahzelezny/Knurlogic
|
|
22
|
+
cd Knurlogic && pip install -e .
|
|
23
|
+
|
|
24
|
+
## Quickstart
|
|
25
|
+
|
|
26
|
+
Get a model in MLX format: search and download it from the page's model
|
|
27
|
+
picker (Hugging Face), or with the `hf` CLI that comes with
|
|
28
|
+
`huggingface_hub`:
|
|
29
|
+
|
|
30
|
+
pip install -U huggingface_hub
|
|
31
|
+
hf download mlx-community/gemma-4-e4b-it-8bit \
|
|
32
|
+
--local-dir ~/Knurlogic/Models/gemma-4-e4b-it-8bit
|
|
33
|
+
|
|
34
|
+
`knurlogic models` lists the models already on this Mac (Knurlogic's own
|
|
35
|
+
folder, the Hugging Face cache, LM Studio, Ollama and exo folders).
|
|
36
|
+
|
|
37
|
+
Check it and serve it:
|
|
38
|
+
|
|
39
|
+
knurlogic doctor ~/Knurlogic/Models/gemma-4-e4b-it-8bit
|
|
40
|
+
knurlogic serve ~/Knurlogic/Models/gemma-4-e4b-it-8bit
|
|
41
|
+
|
|
42
|
+
Then ask it something:
|
|
43
|
+
|
|
44
|
+
curl http://127.0.0.1:8080/v1/chat/completions \
|
|
45
|
+
-H 'Content-Type: application/json' \
|
|
46
|
+
-d '{"model": "local", "messages": [{"role": "user", "content": "Hello"}]}'
|
|
47
|
+
|
|
48
|
+
The page is at http://127.0.0.1:8080/: what is loaded, where the memory
|
|
49
|
+
went, a chat and the settings. `knurlogic ui` opens the page at
|
|
50
|
+
http://127.0.0.1:8899/ without loading anything, with a Launch button for
|
|
51
|
+
every model on the disk, and a gear in the macOS menu bar (`--no-menubar`
|
|
52
|
+
skips it) that shows what is loaded and opens or quits the page.
|
|
53
|
+
|
|
54
|
+
## Connect a harness
|
|
55
|
+
|
|
56
|
+
`knurlogic connect --port 8080` prints these for a running server.
|
|
57
|
+
|
|
58
|
+
**Claude Code** (or any Anthropic Messages client):
|
|
59
|
+
|
|
60
|
+
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 \
|
|
61
|
+
ANTHROPIC_API_KEY=x \
|
|
62
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL=local \
|
|
63
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL=local \
|
|
64
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL=local \
|
|
65
|
+
API_TIMEOUT_MS=3000000 \
|
|
66
|
+
claude
|
|
67
|
+
|
|
68
|
+
**OpenAI-compatible clients** (Zed, Cline, Continue, Open WebUI): base URL
|
|
69
|
+
`http://127.0.0.1:8080/v1`, any API key, model `local`.
|
|
70
|
+
|
|
71
|
+
**Responses-API clients** (the OpenAI SDK's `client.responses`, Codex-style
|
|
72
|
+
tools): the same base URL; `POST /v1/responses` with function tools,
|
|
73
|
+
streaming and reasoning summaries. `previous_response_id` and `store: true`
|
|
74
|
+
are refused: the server keeps no conversation, so resend the input.
|
|
75
|
+
|
|
76
|
+
**Ollama clients** (Open WebUI's Ollama mode, Continue, the `ollama`
|
|
77
|
+
libraries): `OLLAMA_HOST=http://127.0.0.1:8080`. `/api/chat`, `/api/generate`
|
|
78
|
+
(streaming NDJSON by default), `/api/tags`, `/api/show` and `/api/version`
|
|
79
|
+
are served, with images in chat messages on a vision model.
|
|
80
|
+
|
|
81
|
+
**MCP**, for an agent that should manage models rather than talk to one:
|
|
82
|
+
|
|
83
|
+
claude mcp add knurlogic -- knurlogic mcp
|
|
84
|
+
|
|
85
|
+
Its tools are `models`, `fit`, `settings`, `drafting`, `ready`, `load`,
|
|
86
|
+
`state`, `unload` and `deps`; `knurlogic mcp --list` describes each.
|
|
87
|
+
`load` refuses a model that does not fit.
|
|
88
|
+
|
|
89
|
+
## Two or more Macs
|
|
90
|
+
|
|
91
|
+
To split one model across two or more Macs (up to 16) joined by Thunderbolt,
|
|
92
|
+
install the same
|
|
93
|
+
knurlogic version and the model on both, and run on each:
|
|
94
|
+
|
|
95
|
+
knurlogic ui --host cluster
|
|
96
|
+
|
|
97
|
+
The Macs find each other over Bonjour (`--peer HOST` names one directly, on each machine
|
|
98
|
+
(or link them with Thunderbolt);
|
|
99
|
+
`knurlogic doctor --cluster` says what is in the way). Then launch the
|
|
100
|
+
model from the page with the machines selected, or with the MCP `load`
|
|
101
|
+
tool's `machines` argument. The TCP ring works for any number of Macs;
|
|
102
|
+
RDMA (jaccl) needs every pair cabled with Thunderbolt 5, and beyond two
|
|
103
|
+
Macs it is experimental and untested.
|
|
104
|
+
|
|
105
|
+
## Settings
|
|
106
|
+
|
|
107
|
+
Every setting is resolved from the model's `config.json` and the memory
|
|
108
|
+
available, and shown in the page's Settings panel and at `/settings.json`.
|
|
109
|
+
Two presets cover most needs: `default` (fastest) and `lean` (more
|
|
110
|
+
context in less memory: 512-token prompt chunks, MTP off, 8-bit KV).
|
|
111
|
+
`serve --tune default|lean` picks one, `--kv-bits 8` stores the KV cache
|
|
112
|
+
in about half the memory, and `--set KEY=VALUE` overrides any single
|
|
113
|
+
setting. A context length past the model's native window turns on YaRN
|
|
114
|
+
for the Qwen families (up to 1,048,576 tokens).
|
|
115
|
+
|
|
116
|
+
## Supported models
|
|
117
|
+
|
|
118
|
+
| Family | `model_type` | Vision | Drafting (MTP) | 8-bit KV |
|
|
119
|
+
|---|---|---|---|---|
|
|
120
|
+
| Qwen 3.5 / 3.6 | `qwen3_5`, `qwen3_5_moe` | yes | if the model has a head | yes |
|
|
121
|
+
| Qwen 3.8 | `qwen4_exp` | yes | if the model has a head | yes |
|
|
122
|
+
| Gemma 4 | `gemma4`, `gemma4_text` | yes | no | yes |
|
|
123
|
+
| GLM-5 | `glm5_next` | yes | if the model has a head | yes |
|
|
124
|
+
| DeepSeek-V4 | `deepseek_v4` | no | no | no |
|
|
125
|
+
|
|
126
|
+
VQ-quantized models (published with their own `model.py`) are supported
|
|
127
|
+
for these families; each runs the `model.py` it ships. The page tags a
|
|
128
|
+
Hugging Face model "update" when the Hub has a newer revision (checked once
|
|
129
|
+
at start; `knurlogic ui --offline` or `HF_HUB_OFFLINE=1` skips it).
|
|
130
|
+
|
|
131
|
+
## Code
|
|
132
|
+
|
|
133
|
+
How the package is laid out and who may import whom: [docs/architecture.md](docs/architecture.md).
|
|
134
|
+
|
|
135
|
+
## Status
|
|
136
|
+
|
|
137
|
+
Alpha. Expect rough edges and breaking changes before 1.0; see
|
|
138
|
+
CHANGELOG.md.
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
Apache-2.0. Vendored third-party code is listed in NOTICE.
|