Text Generation
Transformers
Safetensors
English
Ganda
gemma3_text
luganda
translation
conversational
gemma
gemma3
fine-tuned
text-generation-inference
Instructions to use CraneAILabs/ganda-gemma-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CraneAILabs/ganda-gemma-1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CraneAILabs/ganda-gemma-1b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CraneAILabs/ganda-gemma-1b") model = AutoModelForCausalLM.from_pretrained("CraneAILabs/ganda-gemma-1b", device_map="auto") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CraneAILabs/ganda-gemma-1b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CraneAILabs/ganda-gemma-1b" # 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/ganda-gemma-1b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CraneAILabs/ganda-gemma-1b
- SGLang
How to use CraneAILabs/ganda-gemma-1b 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 "CraneAILabs/ganda-gemma-1b" \ --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/ganda-gemma-1b", "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 "CraneAILabs/ganda-gemma-1b" \ --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/ganda-gemma-1b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CraneAILabs/ganda-gemma-1b with Docker Model Runner:
docker model run hf.co/CraneAILabs/ganda-gemma-1b
| base_model: google/gemma-3-1b-it | |
| language: | |
| - en | |
| - lg | |
| library_name: transformers | |
| license: gemma | |
| tags: | |
| - luganda | |
| - translation | |
| - conversational | |
| - gemma | |
| - gemma3 | |
| - fine-tuned | |
| pipeline_tag: text-generation | |
| # Ganda Gemma 1B | |
| A fine-tuned Gemma 3 1B instruction model specialized for **English-to-Luganda translation and Luganda conversational AI**. The model accepts input in both English and Luganda but outputs responses exclusively in Luganda. | |
| ## π Translation Performance | |
|  | |
| ### Model Comparison | |
| | Model | Parameters | BLEU | chrF++ | Efficiency* | | |
| |-------|------------|------|--------|-----------| | |
| | Gemma 3 4B | 4B | 1.1 | 20.05 | 0.28 | | |
| | Gemma 3 27B | 27B | 3.65 | 31.37 | 0.14 | | |
| | GPT-5 Mini | N/A | 5.14 | 36.55 | N/A | | |
| | **Ganda Gemma 1B** | **1B** | **6.99** | **40.32** | **6.99** | | |
| | Gemini 2.0 Flash | Large | 7.94 | 43.38 | N/A | | |
| *Efficiency = BLEU Score Γ· Parameters (in billions) | |
| ### Key Performance Insights | |
| π― **Efficiency Leader**: Achieves 6.99 BLEU per billion parameters (highest efficiency ratio) | |
| π **Size Advantage**: Outperforms Gemma 3 4B (4x larger) by 535% on BLEU score | |
| π **Competitive Quality**: Achieves similar performance to GPT-5 Mini with known 1B parameter count | |
| β‘ **Practical Deployment**: Runs efficiently on consumer hardware while maintaining quality | |
| ### Evaluation Details | |
| - **Dataset**: FLORES-200 EnglishβLuganda (1,012 translation pairs) | |
| - **Metrics**: BLEU (bilingual evaluation understudy) and chrF++ (character F-score) | |
| - **Evaluation**: Zero-shot translation performance | |
| ## π Quick Start | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| # Load model and tokenizer | |
| model = AutoModelForCausalLM.from_pretrained("CraneAILabs/ganda-gemma-1b") | |
| tokenizer = AutoTokenizer.from_pretrained("CraneAILabs/ganda-gemma-1b") | |
| # Translate to Luganda | |
| prompt = "Translate to Luganda: Hello, how are you today?" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| outputs = model.generate(**inputs, max_length=100, temperature=0.3) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ## π Language Capabilities | |
| - **Input Languages**: English + Luganda | |
| - **Output Language**: Luganda only | |
| - **Primary Focus**: English-to-Luganda translation and Luganda conversation | |
| ## π― Capabilities | |
| - **Translation**: English-to-Luganda translation | |
| - **Conversational AI**: Natural dialogue in Luganda | |
| - **Summarization**: Text summarization in Luganda | |
| - **Writing**: Creative and informational writing in Luganda | |
| - **Question Answering**: General knowledge responses in Luganda | |
| ## π» Usage Examples | |
| ### Basic Translation | |
| ```python | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained("CraneAILabs/ganda-gemma-1b") | |
| tokenizer = AutoTokenizer.from_pretrained("CraneAILabs/ganda-gemma-1b") | |
| # English to Luganda translation | |
| prompt = "Translate to Luganda: Welcome to our school" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| with torch.no_grad(): | |
| outputs = model.generate( | |
| **inputs, | |
| max_length=100, | |
| temperature=0.3, | |
| do_sample=True, | |
| pad_token_id=tokenizer.eos_token_id | |
| ) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ### Luganda Conversation | |
| ```python | |
| # Direct Luganda conversation | |
| prompt = "Oli otya! Osobola okuntuyamba leero?" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| outputs = model.generate(**inputs, max_length=100, temperature=0.3) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ### Using the Pipeline | |
| ```python | |
| from transformers import pipeline | |
| # Create a text generation pipeline | |
| generator = pipeline( | |
| "text-generation", | |
| model="CraneAILabs/ganda-gemma-1b", | |
| tokenizer="CraneAILabs/ganda-gemma-1b", | |
| device=0 if torch.cuda.is_available() else -1 | |
| ) | |
| # Generate Luganda text | |
| result = generator( | |
| "Translate to Luganda: Welcome to our school", | |
| max_length=100, | |
| temperature=0.3, | |
| do_sample=True | |
| ) | |
| print(result[0]['generated_text']) | |
| ``` | |
| ## π Related Models | |
| - **GGUF Quantizations**: [CraneAILabs/ganda-gemma-1b-GGUF](https://huggingface.co/CraneAILabs/ganda-gemma-1b-GGUF) - Optimized for llama.cpp/Ollama | |
| - **Mobile (LiteRT)**: [CraneAILabs/ganda-gemma-1b-litert](https://huggingface.co/CraneAILabs/ganda-gemma-1b-litert) - Optimized for Android/iOS | |
| ## π¨ Use Cases | |
| - **Translation Apps**: Offline English-Luganda translation | |
| - **Language Learning**: Practice Luganda with instant feedback | |
| - **Cultural Apps**: Create culturally aware Luganda content | |
| - **Educational Tools**: Luganda learning assistants | |
| - **Research**: Natural language processing for Luganda | |
| - **Content Creation**: Generate Luganda content for media | |
| ## β οΈ Limitations | |
| - **Language Output**: Responds only in Luganda | |
| - **Context Length**: Optimized for shorter conversational inputs | |
| - **Cultural Context**: May not capture all nuances of Luganda culture | |
| - **Regional Variations**: Trained on standard Luganda, may not reflect all dialects | |
| ## π οΈ Technical Details | |
| - **Base Model**: Google Gemma 3 1B Instruct | |
| - **Fine-tuning Method**: Supervised fine-tuning on English-Luganda pairs | |
| - **Context Length**: 2048 tokens | |
| - **Precision**: 16-bit floating point | |
| - **Framework**: Transformers (PyTorch) | |
| ## π License | |
| This model is released under the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). Please review the terms before use. | |
| ## π Acknowledgments | |
| - **Google**: For Gemma 3 base model and research | |
| - **Luganda Community**: For language resources and cultural guidance | |
| - **FLORES Team**: For evaluation dataset and benchmarking framework | |
| --- | |
| **Built with β€οΈ by Crane AI Labs** | |
| *Ganda Gemma - Your helpful Luganda AI companion!* | |