İçeriğe geç

MLX-LM Apple Silicon: M-Series Mac'te FT + Serve + Distributed MLX

Apple MLX (2023+) — Apple Silicon (M1/M2/M3) için unified memory ML framework. MLX-LM ile Llama / Qwen / Gemma FT + inference. M3 Max 128GB'da 70B inference, M2 Pro 32GB'da 8B FT. RTX 4090 alternatifi olarak Mac kullananlar için cookbook ek section.

Şükrü Yusuf KAYA
22 dakikalık okuma
Orta
MLX-LM Apple Silicon: M-Series Mac'te FT + Serve + Distributed MLX
bash
# === MLX-LM Llama 3.1 8B M-series Mac ===
pip install mlx-lm
 
# 1. Convert HF → MLX
mlx_lm.convert \
--hf-path meta-llama/Meta-Llama-3.1-8B-Instruct \
--mlx-path llama-3.1-8b-mlx \
--quantize true # 4-bit MLX quant
 
# 2. Inference
mlx_lm.generate \
--model llama-3.1-8b-mlx \
--prompt "İstanbul nüfusu?" \
--max-tokens 200
 
# 3. Fine-tune (LoRA)
mlx_lm.lora \
--model meta-llama/Meta-Llama-3.1-8B-Instruct \
--train \
--data /path/to/tr_alpaca \
--num-layers 16 \
--batch-size 2 \
--lr 1e-4
 
# Inference performance (M-series):
# - M2 Pro 32GB: Llama 8B Q4 → 28 tok/s
# - M3 Max 128GB: Llama 70B Q4 → 12 tok/s, Llama 8B Q4 → 65 tok/s
# - M3 Ultra 256GB: Llama 405B Q4 → 4 tok/s !
MLX-LM convert + inference + fine-tune
✅ Teslim
  1. Eğer Apple Silicon kullanıyorsan MLX-LM ile Llama 8B inference test. 2) Sonraki ders: 15.8 — Speculative Decoding Production.

Yorumlar & Soru-Cevap

(0)
Yorum yazmak için giriş yap.
Yorumlar yükleniyor...

İlgili İçerikler