初始化项目,由ModelHub XC社区提供模型

Model: CraneAILabs/ganda-gemma-1b-GGUF
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-08-31 00:14:17 +08:00
commit 5ec6aeb1ce
12 changed files with 283 additions and 0 deletions

5
.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
*.gguf filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
ganda_gemma_ascending_chart.png filter=lfs diff=lfs merge=lfs -text
ganda_gemma_ascending_clean.png filter=lfs diff=lfs merge=lfs -text

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bdeaa763caada70e145c51a940fde15f152e32d49967f9f0b6c6ca628f131561
size 2006573184

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d9597196323f6fdee288e8db131f43bacc97a98a91932c7cb2f971b0da33225
size 4006076544

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8040bc1ac72a0485b794ac6805844d78618bb3eaaabf489892064b18c91a9677
size 689814144

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e2621229fa7f4c0987fbd79852c8ba9294f1c5d141d5ad05e46d7c0c97962077
size 722415744

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:12e8fce498aa4aaa02f00412d0870f0e39b2d18d7f73cb35c523ead6f1bf2370
size 806057856

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b6b89b0451e540839f50a14acb42d2be891ccc023843682171c140e52437488b
size 780992640

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cef34d4a86d5ee7d7aacac9ec6aa49054fdcb44d6dcda7b984d3ba723dbebfcc
size 851345280

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ed2cfe4d25df96ae2017c2b2b83f9a4ccfd1664610612cce884b370854e077b
size 1069305984

187
README.md Normal file
View File

@@ -0,0 +1,187 @@
---
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
![Translation Performance Comparison](ganda_gemma_ascending_chart.png)
### 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'])
```
### Ollama Usage
```bash
# Run with different quantizations
ollama run crane-ai-labs/ganda-gemma-1b:q4-k-m # Recommended balance
ollama run crane-ai-labs/ganda-gemma-1b:q8-0 # Higher quality
ollama run crane-ai-labs/ganda-gemma-1b:q4-k-s # Smaller size
ollama run crane-ai-labs/ganda-gemma-1b:f16 # Original quality
```
## 🚀 GGUF Advantages
- **Fast CPU Inference**: Optimized for CPU-only environments
- **Memory Efficient**: Multiple quantization levels available
- **Easy Integration**: Works with llama.cpp, Ollama, and other GGUF-compatible tools
- **Cross-Platform**: Supports Windows, macOS, and Linux
## 📦 Available Quantizations
| Quantization | File Size | Memory Usage | Quality | Use Case |
|-------------|-----------|--------------|---------|----------|
| F16 | ~2.0GB | ~3.5GB | Best | GPU inference |
| Q8_0 | ~1.1GB | ~2.0GB | High | High-end CPU |
| Q4_K_M | ~600MB | ~1.2GB | Good | **Recommended** |
| Q4_K_S | ~550MB | ~1.1GB | Decent | Low memory |
| Q4_0 | ~550MB | ~1.0GB | Basic | Very low memory |
## 🔗 Related Models
- **Original Model**: [CraneAILabs/ganda-gemma-1b](https://huggingface.co/CraneAILabs/ganda-gemma-1b) - Full precision HuggingFace model
- **Mobile (LiteRT)**: [CraneAILabs/ganda-gemma-1b-litert](https://huggingface.co/CraneAILabs/ganda-gemma-1b-litert) - Optimized for Android/iOS
## 📄 License
This model is released under the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). Please review the terms before use.
---
**Built with ❤️ by Crane AI Labs**
*Ganda Gemma - Your helpful Luganda AI companion, optimized for CPU!*

64
config.json Normal file
View File

@@ -0,0 +1,64 @@
{
"_sliding_window_pattern": 6,
"architectures": [
"Gemma3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"attn_logit_softcapping": null,
"bos_token_id": 2,
"cache_implementation": "hybrid",
"eos_token_id": 106,
"final_logit_softcapping": null,
"head_dim": 256,
"hidden_activation": "gelu_pytorch_tanh",
"hidden_size": 1152,
"initializer_range": 0.02,
"intermediate_size": 6912,
"layer_types": [
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"sliding_attention",
"full_attention",
"sliding_attention",
"sliding_attention"
],
"max_position_embeddings": 32768,
"model_type": "gemma3_text",
"num_attention_heads": 4,
"num_hidden_layers": 26,
"num_key_value_heads": 1,
"pad_token_id": 0,
"query_pre_attn_scalar": 256,
"rms_norm_eps": 1e-06,
"rope_local_base_freq": 10000,
"rope_scaling": null,
"rope_theta": 1000000,
"sliding_window": 512,
"torch_dtype": "bfloat16",
"transformers_version": "4.54.1",
"unsloth_fixed": true,
"unsloth_version": "2025.7.11",
"use_cache": true,
"vocab_size": 262144
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:358fe0ce5516c724a09cff15d1d8a95ebc8d8b39f5d10481066617c74fabf9bf
size 152124