Instructions to use mouri45/gemma-4-e2b-it-lite-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mouri45/gemma-4-e2b-it-lite-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mouri45/gemma-4-e2b-it-lite-mlx") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use mouri45/gemma-4-e2b-it-lite-mlx with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mouri45/gemma-4-e2b-it-lite-mlx"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mouri45/gemma-4-e2b-it-lite-mlx" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use mouri45/gemma-4-e2b-it-lite-mlx with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mouri45/gemma-4-e2b-it-lite-mlx"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mouri45/gemma-4-e2b-it-lite-mlx
Run Hermes
hermes
- OpenClaw new
How to use mouri45/gemma-4-e2b-it-lite-mlx with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mouri45/gemma-4-e2b-it-lite-mlx"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mouri45/gemma-4-e2b-it-lite-mlx" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use mouri45/gemma-4-e2b-it-lite-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mouri45/gemma-4-e2b-it-lite-mlx"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mouri45/gemma-4-e2b-it-lite-mlx" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mouri45/gemma-4-e2b-it-lite-mlx", "messages": [ {"role": "user", "content": "Hello"} ] }'
| license: apache-2.0 | |
| license_link: https://ai.google.dev/gemma/docs/gemma_4_license | |
| base_model: google/gemma-4-e2b-it | |
| tags: | |
| - mlx | |
| - gemma4 | |
| - text-only | |
| language: | |
| - ja | |
| - en | |
| library_name: mlx | |
| pipeline_tag: text-generation | |
| # gemma-4-e2b-it-lite-mlx | |
| Text-only, lightweight 4-bit MLX quantization of | |
| [google/gemma-4-e2b-it](https://huggingface.co/google/gemma-4-e2b-it), | |
| optimized for on-device inference on iPhone (8GB devices) and Apple Silicon Macs. | |
| **~2.05 GB** — compared to 3.58 GB for the official | |
| [mlx-community/gemma-4-e2b-it-4bit](https://huggingface.co/mlx-community/gemma-4-e2b-it-4bit) | |
| (which bundles the audio/vision towers in BF16). | |
| ## What was changed (modification notice) | |
| - Converted from the original bf16 checkpoint with **mlx-lm 0.31.3** (`mlx_lm.convert`). | |
| - **Text-only**: `audio_tower`, `vision_tower`, `embed_audio`, `embed_vision`, | |
| `multi_modal_projector` weights are not included. This checkpoint works with | |
| text-only Gemma 4 runtimes (e.g. mlx-lm / mlx-swift-lm `MLXLLM`). | |
| - Quantization recipe: **4-bit / group size 64 (affine)** for all layers, except | |
| `embed_tokens_per_layer` (per-layer embeddings, ~1.3 GB at 4-bit) which is | |
| quantized to **2-bit / group size 64**. The per-layer override is recorded in | |
| `config.json` (`quantization` section). | |
| - KV-shared layers (15-34) do not include `k_proj` / `v_proj` / `k_norm` | |
| (same layout as the official MLX conversion). | |
| Japanese smoke tests (greeting / Q&A / no repetition loops) show quality on par | |
| with the official 4-bit conversion on this recipe. A uniform 3-bit recipe of the | |
| same size was clearly worse and was rejected. | |
| ## Attribution | |
| Gemma 4 is developed by **Google DeepMind** and released under the | |
| [Apache License 2.0](https://ai.google.dev/gemma/docs/gemma_4_license). | |
| This repository redistributes a quantized derivative under the same license. | |
| ## Usage (mlx-lm) | |
| ```bash | |
| pip install mlx-lm | |
| mlx_lm.generate --model mouri45/gemma-4-e2b-it-lite-mlx --prompt "こんにちは!" | |
| ``` | |
| Created as part of the AppleSiliconLLM project (Issue0012). | |