Instructions to use ddalcu/gemma-4-e2b-it-4bit-textonly with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ddalcu/gemma-4-e2b-it-4bit-textonly 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("ddalcu/gemma-4-e2b-it-4bit-textonly") 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 ddalcu/gemma-4-e2b-it-4bit-textonly with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ddalcu/gemma-4-e2b-it-4bit-textonly"
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": "ddalcu/gemma-4-e2b-it-4bit-textonly" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use ddalcu/gemma-4-e2b-it-4bit-textonly 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 "ddalcu/gemma-4-e2b-it-4bit-textonly"
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 ddalcu/gemma-4-e2b-it-4bit-textonly
Run Hermes
hermes
- OpenClaw new
How to use ddalcu/gemma-4-e2b-it-4bit-textonly with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ddalcu/gemma-4-e2b-it-4bit-textonly"
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 "ddalcu/gemma-4-e2b-it-4bit-textonly" \ --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 ddalcu/gemma-4-e2b-it-4bit-textonly with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "ddalcu/gemma-4-e2b-it-4bit-textonly"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "ddalcu/gemma-4-e2b-it-4bit-textonly" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ddalcu/gemma-4-e2b-it-4bit-textonly", "messages": [ {"role": "user", "content": "Hello"} ] }'
| library_name: mlx | |
| license: gemma | |
| base_model: google/gemma-4-E2B-it | |
| tags: | |
| - mlx | |
| - mlx-vlm | |
| - gemma4 | |
| - text-generation | |
| # gemma-4-e2b-it-4bit-textonly | |
| A stripped-down MLX build of Google's Gemma 4 E2B (instruction-tuned), based on | |
| [mlx-community/gemma-4-e2b-it-4bit](https://huggingface.co/mlx-community/gemma-4-e2b-it-4bit), | |
| with the **vision tower and audio tower weights removed**. | |
| Gemma 4 E2B is natively multimodal (text/image/audio), but the vision and audio | |
| encoders together account for roughly a quarter of the checkpoint's size while | |
| going largely unused in text-only chat deployments. This variant drops both, | |
| shrinking the download from **3.55 GB to 2.5 GB (~30% smaller)** with no change | |
| to the language model's weights or quantization — text generation quality is | |
| identical to the source model. | |
| Built for **[MLX Chat](https://mlxserve.com)**, an iOS app (not yet released) | |
| that runs Gemma 4 fully on-device. Apple App Store review flagged the original | |
| build's download size, and this app doesn't use image or audio input, so both | |
| towers were removed rather than kept unused. | |
| - Source: `mlx-community/gemma-4-e2b-it-4bit` | |
| - Removed: all `vision_tower.*`, `embed_vision.*`, `audio_tower.*`, `embed_audio.*` tensors (1,415 of 2,511 total) | |
| - Quantization: unchanged (4-bit affine, language backbone + embeddings, same as source) | |
| - `config.json`: `audio_config` set to `null`; `vision_config` left in place structurally (some MLX loaders instantiate the vision module unconditionally) — load with `strict=False` if your loader errors on the missing vision weights | |
| ## What this model can't do | |
| No image or audio input. Text-in, text-out only. If you need Gemma 4's | |
| multimodal capabilities, use the upstream | |
| [mlx-community/gemma-4-e2b-it-4bit](https://huggingface.co/mlx-community/gemma-4-e2b-it-4bit) instead. | |
| ## Usage | |
| ```bash | |
| pip install mlx-vlm | |
| python -m mlx_vlm generate \ | |
| --model ddalcu/gemma-4-e2b-it-4bit-textonly \ | |
| --prompt "Explain what a black hole is in two sentences." \ | |
| --max-tokens 80 | |
| ``` | |
| If your `mlx-vlm` version raises a shape error while loading, load with | |
| `strict=False`: | |
| ```python | |
| from mlx_vlm import load, generate | |
| model, processor = load("ddalcu/gemma-4-e2b-it-4bit-textonly", strict=False) | |
| ``` | |