Swahili Gemma 1B
Collection
A fine-tuned Gemma 3 (1B) instruction model specialized for English–Swahili translation & Swahili conversational AI. • 4 items • Updated • 4
How to use CraneAILabs/swahili-gemma-1b-mlx-fp16 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="CraneAILabs/swahili-gemma-1b-mlx-fp16")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("CraneAILabs/swahili-gemma-1b-mlx-fp16", dtype="auto")How to use CraneAILabs/swahili-gemma-1b-mlx-fp16 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("CraneAILabs/swahili-gemma-1b-mlx-fp16")
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)How to use CraneAILabs/swahili-gemma-1b-mlx-fp16 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "CraneAILabs/swahili-gemma-1b-mlx-fp16"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "CraneAILabs/swahili-gemma-1b-mlx-fp16",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/CraneAILabs/swahili-gemma-1b-mlx-fp16
How to use CraneAILabs/swahili-gemma-1b-mlx-fp16 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "CraneAILabs/swahili-gemma-1b-mlx-fp16" \
--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": "CraneAILabs/swahili-gemma-1b-mlx-fp16",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "CraneAILabs/swahili-gemma-1b-mlx-fp16" \
--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": "CraneAILabs/swahili-gemma-1b-mlx-fp16",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use CraneAILabs/swahili-gemma-1b-mlx-fp16 with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "CraneAILabs/swahili-gemma-1b-mlx-fp16"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "CraneAILabs/swahili-gemma-1b-mlx-fp16"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "CraneAILabs/swahili-gemma-1b-mlx-fp16",
"messages": [
{"role": "user", "content": "Hello"}
]
}'How to use CraneAILabs/swahili-gemma-1b-mlx-fp16 with Docker Model Runner:
docker model run hf.co/CraneAILabs/swahili-gemma-1b-mlx-fp16
The Model Bronsn/swahili-gemma-1b-mlx-fp16 was converted to MLX format from CraneAILabs/swahili-gemma-1b using mlx-lm version 0.26.3.
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("Bronsn/swahili-gemma-1b-mlx-fp16")
prompt="hello"
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
response = generate(model, tokenizer, prompt=prompt, verbose=True)
Quantized
Base model
google/gemma-3-1b-pt