You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Apple MLX backend for native Metal GPU acceleration on macOS
Introduce a dual-backend architecture (tch-backend vs mlx) with a unified
Tensor abstraction, following the pattern from qwen3_tts_rs. The MLX backend
builds mlx-c from a git submodule and uses Metal GPU natively on Apple Silicon,
eliminating the libtorch dependency on macOS.
- Add src/tensor.rs unified Tensor type wrapping tch::Tensor or MlxArray via #[cfg]
- Add src/backend/mlx/ with FFI bindings, RAII array wrapper, ops, I/O, signal processing
- Add build.rs for CMake-based mlx-c compilation
- Port all model code (layers, encoder, decoder, inference) to use unified Tensor
- Update CI to test both tch and mlx backends on macOS
- Update release workflow to build mlx for macOS, tch for Linux
- Fix release zip structure to expand into a named directory
- Update skills/ for macOS MLX (no libtorch needed) and 0.6B model only
Signed-off-by: Michael Yuan <michael@secondstate.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+36-3Lines changed: 36 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Qwen3 ASR Rust
2
2
3
-
Pure Rust implementation of [Qwen3-ASR](https://github.com/QwenLM/Qwen3-ASR) automatic speech recognition using libtorch. Loads model weights directly from safetensors files and re-implements the complete neural network forward pass in Rust.
3
+
Pure Rust implementation of [Qwen3-ASR](https://github.com/QwenLM/Qwen3-ASR) automatic speech recognition. Supports two backends: **libtorch** (via the `tch` crate, cross-platform with optional CUDA) and **MLX** (Apple Silicon native via Metal GPU). Loads model weights directly from safetensors files and re-implements the complete neural network forward pass in Rust.
4
4
5
5
## Architecture
6
6
@@ -19,7 +19,16 @@ The implementation ports the Qwen3-ASR encoder-decoder architecture from PyTorch
19
19
20
20
## Prerequisites
21
21
22
-
### libtorch
22
+
### Backend
23
+
24
+
Choose one backend:
25
+
26
+
| Backend | Feature flag | Platforms | GPU |
27
+
|---------|-------------|-----------|-----|
28
+
| libtorch |`tch-backend` (default) | Linux, macOS, Windows | CUDA |
29
+
| MLX |`mlx`| macOS Apple Silicon | Metal |
30
+
31
+
### libtorch (for `tch-backend`)
23
32
24
33
The `tch` crate (v0.20) requires **libtorch 2.7.1**. Download and extract for your platform:
0 commit comments