chatgpt-4o-latest-20250326· OpenAI
LMArena Human Preference 140K
give me minimal code to run gemma 3 12b it on mac mlx
- User
give me minimal code to run gemma 3 12b it on mac mlx
- Assistant
Sure! Here's a minimal example to run the Gemma 3 12B (IT) model on a Mac using MLX:
First, make sure you have MLX installed:
pip install mlxNow, the minimal code:
import mlx.core as mx import mlx.nn as nn from mlx_lm import load, generate # Load the model model, tokenizer = load("google/gemma-1.1-12b-it") # Generate text prompt = "Once upon a time," output = generate(model, tokenizer, prompt, verbose=True) print(output)—
✅ Notes:
mlx_lmis a lightweight library to load and run LLMs on MLX.- Install it via:
pip install mlx-lm
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.