Instructions to use aqweteddy/gemma-4-E4B-it-text with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aqweteddy/gemma-4-E4B-it-text with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aqweteddy/gemma-4-E4B-it-text") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("aqweteddy/gemma-4-E4B-it-text") model = AutoModelForCausalLM.from_pretrained("aqweteddy/gemma-4-E4B-it-text") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use aqweteddy/gemma-4-E4B-it-text with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aqweteddy/gemma-4-E4B-it-text" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aqweteddy/gemma-4-E4B-it-text", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/aqweteddy/gemma-4-E4B-it-text
- SGLang
How to use aqweteddy/gemma-4-E4B-it-text 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 "aqweteddy/gemma-4-E4B-it-text" \ --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": "aqweteddy/gemma-4-E4B-it-text", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "aqweteddy/gemma-4-E4B-it-text" \ --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": "aqweteddy/gemma-4-E4B-it-text", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use aqweteddy/gemma-4-E4B-it-text with Docker Model Runner:
docker model run hf.co/aqweteddy/gemma-4-E4B-it-text
Gemma 4 E4B-it (Causal / Text-Only)
This is the text-only (causal LM) version of google/gemma-4-E4B-it, with vision encoder weights removed. Only the text decoder is retained.
License: Same as the original — see Gemma Terms of Use.
Serving with vLLM
python3 -m vllm.entrypoints.openai.api_server \
--model /model \
--served-model-name '$MODEL' \
--tensor-parallel-size 1 \
--dtype auto \
--kv-cache-dtype fp8_e4m3 \
--max-model-len 32768 \
--gpu-memory-utilization '$GPU_MEM_UTIL' \
--enforce-eager \
--enable-chunked-prefill \
--max-num-batched-tokens 8192 \
--language-model-only \
--enable-auto-tool-choice \
--reasoning-parser gemma4 \
--tool-call-parser gemma4 \
--async-scheduling \
--enable-prefix-caching \
--host 0.0.0.0
Notes on Loading with Transformers
If loading with transformers, the following missing-key warnings are expected and harmless due to Gemma 4's share_kv_layer mechanism (layers 24-41 share KV weights from earlier layers):
model = AutoModelForCausalLM.from_pretrained('aqweteddy/gemma-4-E4B-it-text')
# output
Key | Status |
-----------------------------------------------+---------+-
model.layers.{24...41}.self_attn.v_proj.weight | MISSING |
model.layers.{24...41}.self_attn.k_proj.weight | MISSING |
These do not affect generation results.
Quick Test
curl -s http://localhost:4315/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gemma-4-E4B-it-causal",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 100
}'
Expected response:
{
"model": "gemma-4-E4B-it-causal",
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
]
}
- Downloads last month
- 34