Repository navigation
Remove coreml - #754
Remove coreml#754
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes Apple CoreML/NPU support across the Python transpiler, C++ engine, and associated docs/tests, while standardizing bundle naming/selection to CQ-bit-only variants and shifting acceleration messaging toward Metal GPU. It also introduces per-op backend pinning (CPU vs Metal) in the graph/runtime surface, including a new FFI to tag node backends.
Changes:
- Remove CoreML/NPU emission pipeline (Python) and ANE/NPU runtime paths (C++), plus related flags/docs.
- Simplify bundle variant logic by dropping
--weights/ platform suffixes and parsing only-cq<bits>artifacts. - Update graph/runtime backend handling to be per-node pinnable with CPU/Metal and refresh parity tests/documentation accordingly.
Reviewed changes
Copilot reviewed 72 out of 73 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates CLI/help text and benchmark wording after removing weights variants. |
| python/tests/test_server_live.py | Updates bundle stem comment to remove -apple variant mention. |
| python/tests/test_model.py | Removes platform/weights variant selection from tests. |
| python/tests/test_download.py | Updates archive parsing/resolution tests for CQ-bit-only artifacts. |
| python/tests/test_cli_run.py | Removes weights arg from CLI run test fixture. |
| python/tests/test_bindings.py | Removes --weights flag parsing tests. |
| python/tests/bundles.py | Updates bundle candidate docstring to remove -apple suffix mention. |
| python/README.md | Removes weights variant examples; documents per-op backend kwarg usage. |
| python/pyproject.toml | Drops coremltools dependency on Darwin. |
| python/cactus/transpile/tdt_runtime.py | Removes ANE-specific encoder code paths and env knobs. |
| python/cactus/transpile/runtime_compat.py | Switches to per-node backend tagging via _apply_backend + new FFI signature changes. |
| python/cactus/transpile/README.md | Removes mention of .mlpackage runtime dispatch. |
| python/cactus/transpile/npu/vision.py | Deletes CoreML vision encoder emission helper. |
| python/cactus/transpile/npu/source.py | Deletes CoreML source encoder emission helper. |
| python/cactus/transpile/npu/README.md | Deletes NPU transpiler pipeline documentation. |
| python/cactus/transpile/npu/pipeline.py | Deletes NPU/CoreML emission orchestrator. |
| python/cactus/transpile/npu/coremltools_patches.py | Deletes CoreMLTools patch layer. |
| python/cactus/transpile/npu/audio.py | Deletes CoreML audio encoder emission helper. |
| python/cactus/transpile/npu/init.py | Removes NPU package export. |
| python/cactus/transpile/model_adapters.py | Removes Gemma4 NPU reparam + NPU module fields in specs. |
| python/cactus/transpile/hf_model.py | Removes --npu* CLI flags and manifest injection of .mlpackage paths. |
| python/cactus/transpile/component_pipeline.py | Removes NPU-related fields from ComponentModuleSpec. |
| python/cactus/server.py | Updates server bundle-stem comment to remove -apple example. |
| python/cactus/cli/utils.py | Simplifies CQ variant parsing/selection; removes platform dimension. |
| python/cactus/cli/upload.py | Updates upload naming to use CQ bits only (no platform suffix). |
| python/cactus/cli/test.py | Only forwards --backend when explicitly set (default remains auto). |
| python/cactus/cli/serve.py | Only forces backend when explicitly set (default remains auto). |
| python/cactus/cli/runtime.py | Removes CoreML framework from Python runtime link flags. |
| python/cactus/cli/model.py | Removes platform/weights handling and NPU-related transpile options. |
| python/cactus/cli/list.py | Changes listing output format to a unified “Available models” table. |
| python/cactus/cli/download.py | Removes weights variant resolution and makes bundle dir CQ-bit-only. |
| python/cactus/cli/convert.py | Removes weights variant handling and NPU flag forwarding. |
| python/cactus/cli/compile.py | Removes CoreML framework from build link flags. |
| python/cactus/cli/common.py | Removes supported weights variants constant. |
| python/cactus/cli/code.py | Removes --weights handling; only forwards backend when set. |
| python/cactus/cli/init.py | Removes --weights/NPU CLI flags; updates backend options; adds upload command wiring. |
| python/cactus/init.py | Removes some exports (e.g., language detection / decode tokens). |
| llms.txt | Updates acceleration claim from NPU to Metal. |
| docs/choose-bindings.md | Updates Swift binding description from NPU to Metal. |
| docs/cactus_transpiler.md | Updates bundle path conventions and removes NPU emission section. |
| docs/cactus_graph.md | Updates backend selection guidance to CPU/Metal with per-op pinning. |
| docs/cactus_engine.md | Removes weights variant path and --weights apple mention. |
| cactus-graph/tests/test_metal_parity.cpp | Refactors parity tests for per-op backend pinning and removes “auto” resets. |
| cactus-graph/src/param_io.cpp | Treats backend as runtime-only (no longer serialized). |
| cactus-graph/src/ops_tensor.cpp | Removes NPU-not-implemented guard now that NPU backend is removed. |
| cactus-graph/src/ops_nn.cpp | Gates Metal kernels by node backend pin + availability, removes NPU stubs. |
| cactus-graph/src/ops_conv.cpp | Removes NPU-not-implemented guards now that NPU backend is removed. |
| cactus-graph/src/ops_cache.cpp | Updates residency logic to use cactus_default_backend()==METAL. |
| cactus-graph/src/metal_plan.cpp | Prevents Metal fusion planning over CPU-pinned nodes. |
| cactus-graph/src/io.cpp | Adds backend tagging to embedding node creation. |
| cactus-graph/src/graph_ffi.cpp | Removes per-op backend args from many FFI calls; adds cactus_graph_set_node_backend. |
| cactus-graph/src/execute.cpp | Reworks backend selection and adds cactus_default_backend() used as the default for ops. |
| cactus-graph/cactus_graph.h | Removes NPU backend, adds cactus_default_backend(), expands backend params across graph ops. |
| cactus-engine/tests/test_utils.cpp | Adjusts backend env handling logic for tests. |
| cactus-engine/tests/run.cpp | Updates backend CLI validation/error message (no “auto”). |
| cactus-engine/tests/ios/configure_xcode.rb | Removes CoreML framework from iOS test app link flags. |
| cactus-engine/test.sh | Changes default backend from auto to empty/unset. |
| cactus-engine/src/npu.cpp | Deletes NPU stub implementation. |
| cactus-engine/src/npu_ane.mm | Deletes ANE/CoreML implementation. |
| cactus-engine/src/npu_ane.h | Deletes ANE/CoreML header. |
| cactus-engine/src/model.cpp | Removes NPU encoder load/execute paths and updates Metal/backend checks. |
| cactus-engine/src/model_npu.cpp | Deletes NPU model integration code. |
| cactus-engine/src/engine.h | Removes NPU encoder interfaces and related model fields. |
| cactus-engine/CMakeLists.txt | Removes NPU sources and CoreML framework linking. |
| cactus-engine/cactus_engine.h | Adds new audio preprocess FFI declaration. |
| cactus-code/package-lock.json | Removes some optional deps entries (e.g., ws, zod) from lockfile. |
| blog/lfm2.5_350m.md | Updates narrative away from “NPU” to “dedicated accelerators” and generalizes wording. |
| blog/hybrid_transcription.md | Removes “NPUs” claim in engine description. |
| blog/gemma4.md | Updates performance narrative and Swift binding description from NPU to Metal. |
| bindings/rust/cactus.rs | Swaps CoreML framework link for Metal + MPS on macOS. |
| apple/CMakeLists.txt | Removes CoreML framework from Apple framework link flags. |
Files not reviewed (1)
- cactus-code/package-lock.json: Generated file
Comments suppressed due to low confidence (1)
cactus-engine/tests/test_utils.cpp:17
TestUtils::apply_backend()will now treatCACTUS_TEST_BACKEND=autoas an invalid backend and print "unavailable; using default". Several test runners default this env var toauto(e.g.cactus-engine/tests/android/run.shandcactus-engine/tests/ios/run.sh), so this change will add noisy output and makes it harder to tell when a backend is truly misconfigured.
Either ignore "auto" here (treat it the same as unset), or teach the backend selector to accept "auto" explicitly and print a clearer message.
const char* b = std::getenv("CACTUS_TEST_BACKEND");
if (!b || !*b) return;
if (cactus_set_backend(b) == 0)
std::cout << "Backend: " << (std::strcmp(b, "metal") == 0 ? "Metal GPU" : "CPU") << "\n";
else
std::cout << "Backend '" << b << "' unavailable; using default\n";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ComputeBackend cactus_default_backend() { | ||
| if (g_selected_backend >= 0) return static_cast<ComputeBackend>(g_selected_backend); | ||
| if (cactus_metal_available()) return ComputeBackend::METAL; | ||
| return ComputeBackend::CPU; | ||
| } | ||
|
|
||
| int cactus_backend_select(const char* backend) { | ||
| if (!backend) return -1; | ||
| if (std::strcmp(backend, "auto") == 0) { g_backend_override = -1; return 0; } | ||
| if (std::strcmp(backend, "metal") == 0) { | ||
| if (!cactus_metal_available()) return -1; | ||
| g_backend_override = 1; | ||
| return 0; | ||
| } | ||
| if (std::strcmp(backend, "cpu") == 0) { g_backend_override = 0; return 0; } | ||
| return -1; | ||
| ComputeBackend selected; | ||
| if (std::strcmp(backend, "cpu") == 0) selected = ComputeBackend::CPU; | ||
| else if (std::strcmp(backend, "metal") == 0 && cactus_metal_available()) selected = ComputeBackend::METAL; | ||
| else return -1; | ||
| g_selected_backend = static_cast<int>(selected); | ||
| return 0; | ||
| } |
No description provided.