⚡ Zen LM
Training

MLX Training

Train on Apple Silicon with MLX

MLX Training (Apple Silicon)

Train zen-coder-flash on M1/M2/M3 Macs using MLX.

Requirements

  • Apple Silicon Mac (M1/M2/M3)
  • 32GB+ unified memory recommended
  • macOS 14+

Installation

pip install mlx mlx-lm

Training

# Clone the repo
git clone https://github.com/zenlm/zen-coder-flash
cd zen-coder-flash

# Train with LoRA
python training/train_mlx.py

# With custom options
python training/train_mlx.py --iters 500 --batch-size 2 --lr 1e-5

Options

OptionDefaultDescription
--iters200Training iterations
--batch-size1Batch size
--lr1e-4Learning rate
--lora-rank16LoRA rank

Fuse Adapters

After training, fuse the LoRA adapters:

python training/train_mlx.py fuse

Test

Test the trained model:

python training/train_mlx.py test

Expected Time

~30 minutes on M3 Max with 64GB unified memory.

MLX training is memory-efficient and uses Apple's Metal Performance Shaders for GPU acceleration.

On this page