Repository navigation
feat(local): add LOCAL_ENGINE=turbo-fieldfare support, HTTP adapter, and client/gateway tests - #106
Merged
ghchinoy merged 1 commit intoDec 1, 2026
Conversation
…and client/gateway tests
Adds opt-in LOCAL_ENGINE=turbo-fieldfare support alongside the default
LOCAL_ENGINE=diffgemma for SSD-streaming DiffusionGemma 26B-A4B on Apple
Silicon Macs (based on drumih/turbo-fieldfare, Apache-2.0):
- scripts/turbo_fieldfare_server.py: persistent-subprocess ThreadingHTTPServer
bridging TurboFieldfareDiffusionProbe to dgem's :8080 contract (/health,
/ready, /v1/models, /v1/chat/completions, /v1/systemone) by reusing
structured_server.py's schema, layout, isolation, DAG, and lossless
slot-logprob math; enforces X-DGem-Key on POST, refuses multimodal/think>0
with 4xx, auto-selects bundled <model>/tokenizer, and recommends bimodal
expert cache slots (16 on <=16 GB Macs, 128 on >=24 GB Macs).
- scripts/{setup,download,serve,stop}_turbo_fieldfare.sh + Makefile wiring
for LOCAL_ENGINE=diffgemma|turbo-fieldfare across setup, download, serve,
stop, local-up, local-down, local-status, and clean.
- cmd/mcp.go: read actual local model ID from /v1/models in
CheckHealthAndGPUStatusForBackend instead of hardcoding diffgemma.
- scripts/test_turbo_fieldfare_server.py (7 Python unit tests),
pkg/client/turbo_fieldfare_test.go, and cmd/backend_local_test.go (-race
client, lossless logprob temperature scaling, timeout, and gateway proxy
compatibility tests).
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in
LOCAL_ENGINE=turbo-fieldfaresupport alongside the defaultLOCAL_ENGINE=diffgemmafor running DiffusionGemma 26B-A4B via SSD-streaming Metal 4 on Apple Silicon Macs (8/16/32 GB, built ondrumih/turbo-fieldfare, Apache-2.0):scripts/turbo_fieldfare_server.py):TurboFieldfareDiffusionProbeas a persistent child process behind aThreadingHTTPServer(soGET /health,GET /ready, andGET /v1/modelsremain non-blocking while inference runs).deploy/cloudrun/server/structured_server.pydirectly for prompt building (document_first/schema_first),CANVAS_LEN=64layout,isolate(auto/noul/all),depends_on/ask_ifDAGs, and losslessdiagnostics.questions[qid].logprobs.GET /health,GET /ready(503while loading,200once warm),GET /v1/models,POST /v1/chat/completions, andPOST /v1/systemone.X-DGem-KeyonPOSTwhenDGEM_SERVER_KEYis set, refuses multimodal inputs andthink > 0with4xx, auto-detects bundled<model>/tokenizer, and auto-selects bimodal expert-cache slots (16on<= 16 GBMacs,128on>= 24 GBMacs; warns on32/64).Makefile&scripts/LOCAL_ENGINEWiring:LOCAL_ENGINE ?= diffgemmaacrosssetup,download,serve,stop,local-up,local-down,local-status, andclean, backed byscripts/{setup,download,serve,stop}_turbo_fieldfare.sh(defaultdiffgemmabehavior is unchanged).cmd/mcp.go,pkg/client/,cmd/):CheckHealthAndGPUStatusForBackendincmd/mcp.goto read the served local model ID from/v1/models(falling back todiffgemma-26b-a4b-it-q4).-racetests inpkg/client/turbo_fieldfare_test.goandcmd/backend_local_test.goverifying SSD-streaming client/proxy timeouts (>= 60s), lossless diagnostic logprob temperature rescaling,X-DGem-Key,400refusal on multimodal requests, concurrentv1ProxyHandlerforwarding, and Cloud Run warm-state isolation.scripts/test_turbo_fieldfare_server.py(7 unit tests runnable without Swift binary, weights, or GPU).Surface & Documentation Checklist
http://127.0.0.1:8080/v1via the samelocalbackend contract).docs/anddocs-site/are synced (follow-up docs & attribution PR will updatelaptop.md,metal-engine.md,hardware.md, andNOTICE).studio/dist/*) are included.Verification
go vet ./... && go test -race ./... && go -C examples vet ./... && go -C examples test ./...python3 -m unittest scripts/test_turbo_fieldfare_server.py scripts/matrix/test_matrix.py deploy/cloudrun/server/test_*.py(83 tests, 0 failures)bash -n scripts/*_turbo_fieldfare.sh./bin/dgem decide -u http://127.0.0.1:18089/v1 -t templates/support_triage.json.tmplagainstscripts/turbo_fieldfare_server.py+TurboFieldfareDiffusionProbe(slots=16) returned validanswers,diagnostics.timing, and losslessdiagnostics.questions.*.logprobs.