|
Hi HN, I ported the Python MLX bindings to Ruby
(https://github.com/ml-explore/mlx). GitHub: https://github.com/skryl/mlx-ruby MLX-Ruby is a native C++ extension that wraps the upstream MLX runtime, giving Ruby full access to the array framework, neural network layers, optimizers, and Metal GPU acceleration on Apple silicon. What’s included:
∙Lazy arrays with dynamic graph construction
∙Function transforms: grad, value_and_grad, vmap, jvp, vjp, compile
∙Full NN module system: Conv2d, Linear, Embedding, Transformer layers, RNNs, etc.
∙Optimizers: Adam, AdamW, SGD, and more
∙A Ruby DSL for declarative model definition, training loops, and checkpointing
∙CPU and Metal GPU support Working examples (https://github.com/skryl/mlx-ruby-examples):
∙LLaMA inference
∙Stable Diffusion
∙Whisper
∙Transformer language model
∙LoRA fine-tuning |
Ruby deserves better ML tooling. The language is expressive enough that model definitions can actually be more readable than their Python equivalents. gem install mlx to try it out.