Instructions to use hexoy/gemma-4-e2b-monarch-35mlp-lora-r8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hexoy/gemma-4-e2b-monarch-35mlp-lora-r8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hexoy/gemma-4-e2b-monarch-35mlp-lora-r8", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("hexoy/gemma-4-e2b-monarch-35mlp-lora-r8", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hexoy/gemma-4-e2b-monarch-35mlp-lora-r8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/hexoy/gemma-4-e2b-monarch-35mlp-lora-r8
- SGLang
How to use hexoy/gemma-4-e2b-monarch-35mlp-lora-r8 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use hexoy/gemma-4-e2b-monarch-35mlp-lora-r8 with Docker Model Runner:
docker model run hf.co/hexoy/gemma-4-e2b-monarch-35mlp-lora-r8
Gemma 4 E2B Distilled + LoRA R8
Experimental benchmark-recovery model. It adds native rank-8, alpha-16 LoRA
residuals to all 105 Monarch MLP projections and loads without PEFT. The model
has 3,691,669,024 parameters, including 9,400,320 LoRA parameters.
1. Weight Storage
| Model | Status | Loaded weights | Serialized weights | Reduction vs dense BF16 |
|---|---|---|---|---|
| Dense Gemma 4 BF16 | Reference | 9.507 GiB | 9.543 GiB | - |
| Distilled Gemma 4 BF16 | Released | 6.859 GiB | 6.859 GiB | 27.86% |
| Distilled Gemma 4 + LoRA r8 BF16 | Experimental | 6.876 GiB | 6.877 GiB | 27.68% |
| Distilled Gemma 4 + INT8 linears | Released | 6.135 GiB | 6.136 GiB | 35.48% |
BF16 sizes use two bytes per parameter; serialized LoRA size was audited from the two safetensor shards. Values exclude activations and CUDA workspaces.
2. TinyHellaSwag
All rows used the same RTX PRO 6000, fixed batch size 32, seed 1234, 100
official examples, 10-shot prompts, and no chat template.
| Model | Status | GP-IRT accuracy | Raw accuracy | Runtime | Peak VRAM |
|---|---|---|---|---|---|
| Dense Gemma 4 BF16 | Reference | 39.23% | 29% | 28.50 s | 57.88 GiB |
| Distilled Gemma 4 BF16 | Released | 32.35% | 22% | 23.33 s | 55.23 GiB |
| Distilled Gemma 4 + LoRA r8 BF16 | Experimental | 33.25% | 23% | 24.93 s | 55.25 GiB |
| Distilled Gemma 4 + INT8 linears | Released | 30.57% | 21% | 23.14 s | 54.51 GiB |
Rank-8 LoRA improved the 35-layer source by 0.90 GP-IRT points and one correct
item, but missed the former +1.0 point or +2 item release gate. The
100-example benchmark is noisy.
Usage
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "hexoy/gemma-4-e2b-monarch-35mlp-lora-r8"
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
trust_remote_code=True,
dtype="auto",
device_map="auto",
)
The standalone export passed exact LoRA state and BF16 logit round trips plus a clean-cache load. Corrected 64-token generation repeated phrases for text and produced malformed or inaccurate answers on all three image tests. Treat this as a benchmark result, not a general text or multimodal recovery release.
Reproducibility
- Base revision:
f897353fca328b1cc5fd2e12d645773ca637f5f0 - LoRA source commit:
1435571b20dd26c073a535678975884154add5b8 - BF16 source:
hexoy/gemma-4-e2b-distilled - INT8 variant:
hexoy/gemma-4-e2b-monarch-35mlp-int8
Detailed training and release evidence is retained privately.
This repository contains custom modeling code. Review it before enabling
trust_remote_code=True. This is an experimental derivative, not an official
Google release.
- Downloads last month
- 52