Instructions to use afkfatih/Gemma3-4B-TR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use afkfatih/Gemma3-4B-TR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="afkfatih/Gemma3-4B-TR")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("afkfatih/Gemma3-4B-TR", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use afkfatih/Gemma3-4B-TR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "afkfatih/Gemma3-4B-TR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afkfatih/Gemma3-4B-TR", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/afkfatih/Gemma3-4B-TR
- SGLang
How to use afkfatih/Gemma3-4B-TR 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 "afkfatih/Gemma3-4B-TR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afkfatih/Gemma3-4B-TR", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "afkfatih/Gemma3-4B-TR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afkfatih/Gemma3-4B-TR", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Studio new
How to use afkfatih/Gemma3-4B-TR with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for afkfatih/Gemma3-4B-TR to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for afkfatih/Gemma3-4B-TR to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for afkfatih/Gemma3-4B-TR to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="afkfatih/Gemma3-4B-TR", max_seq_length=2048, ) - Docker Model Runner
How to use afkfatih/Gemma3-4B-TR with Docker Model Runner:
docker model run hf.co/afkfatih/Gemma3-4B-TR
Gemma3-4B-TR
Google Gemma 3 4B temel modelinin Türkçe dil görevleri için özel olarak fine-tune edilmiş versiyonu.
🎯 Proje Hakkında
Bu projeyi tamamen tek başıma oluşturdum. Gemma 3 4B temel modelini Türkçe için fine-tune ederek Türkçe dil görevlerinde başarılı sonuçlar elde ettim. Sıfırdan model eğitimi değil, mevcut modelin Türkçe'ye adaptasyonu yapıldı.
Model mevcut haliyle bile Türkçe dil görevlerinde başarılı performans göstermektedir. Daha fazla epoch ve daha geniş veri seti ile eğitim yapılması durumunda performans önemli ölçüde artırılabilir.
💰 Destek Talebi
Modeli daha da geliştirmek ve kapsamlı eğitimler yapmak istiyorum ancak GPU kiralama maliyetleri oldukça yüksek. Bu konuda maddi destek veya sponsorluk desteği alabildiğim takdirde projeyi ileri seviyelere taşıyabilirim.
İletişim: afkfatih
📋 Model Detayları
- Geliştirici: afkfatih
- Temel Model: unsloth/gemma-3-4b-it-unsloth-bnb-4bit
- Dil: Türkçe (Turkish)
- Model Boyutu: 4B parametre
- Fine-tuning Yöntemi: LoRA (Low-Rank Adaptation)
- Eğitim Veri Seti: afkfatih/turkish-gemma-51k
- Eğitim Örnekleri: 51,914
- Eğitilen Parametreler: 14,901,248 / 3,895,164,416 (%0.38)
📜 Lisans ve Kullanım Hakları
Bu model Gemma Terms of Use koşullarına tabidir.
Kullanım İzinleri
✅ Model üzerinde değişiklik yapılabilir - Fine-tuning ve modifikasyon mümkündür ✅ Üretilen çıktılar size aittir - Google, modelinizin ürettiği içerikler üzerinde hak iddia etmez ✅ Redistribution izni - Belirli koşullar altında yeniden dağıtım yapılabilir
Önemli Kısıtlamalar
⚠️ Gemma Prohibited Use Policy'ye uyulmalıdır:
- Yasal olmayan, zararlı veya kötü niyetli aktiviteler için kullanılamaz
- Çocuk istismarı, şiddet, terörizm gibi içerikler üretilemez
- Telif hakkı ihlali yapılamaz
- Spam, phishing, malware üretimi yasaktır
- Cinsel içerik üretimi yasaktır (eğitim/bilimsel amaçlar hariç)
- Yanıltıcı bilgi üretimi yasaktır
⚠️ Model dağıtımı koşulları:
- Gemma Terms of Use belgesini eklemeniz gerekmektedir
- Modifikasyon yaptığınızı açıkça belirtmelisiniz
- Türev modeller de Gemma lisansına tabidir
⚠️ Google markaları izinsiz kullanılamaz
⚠️ Google, şartlara aykırı kullanımı uzaktan durdurma hakkına sahiptir
📖 Detaylı lisans bilgisi:
Not: Bu model Gemma 3 4B'nin fine-tuned türevi olduğu için yukarıdaki tüm koşullar geçerlidir.
🚀 Kurulum ve Kullanım
Gereksinimler
pip install unsloth transformers torch
Temel Kullanım
from unsloth import FastLanguageModel
# Modeli yükle
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="afkfatih/Gemma3-4B-TR",
max_seq_length=2048,
dtype=None,
load_in_4bit=True,
)
# Inference modu
FastLanguageModel.for_inference(model)
# Mesaj hazırla
messages = [
{
"role": "user",
"content": [{"type": "text", "text": "Merhaba! Türkiye'nin başkenti neresidir?"}]
}
]
# Yanıt üret
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=128,
temperature=1.0,
top_k=64,
top_p=0.95,
use_cache=True
)
yanit = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(yanit)
📊 Performans
| Metrik | Değer |
|---|---|
| Başlangıç Loss | 2.46 |
| Son Loss | 1.50 |
| Toplam Steps | 1,623 |
| Training Duration | 1 epoch |
💡 Kullanım Alanları
- ✅ Türkçe chatbot ve asistan uygulamaları
- ✅ Türkçe soru-cevap (Q&A) sistemleri
- ✅ Türkçe metin üretimi (text generation)
- ✅ Türkçe doğal dil anlama (NLU) görevleri
- ✅ Müşteri hizmetleri otomasyonu
- ✅ Eğitim teknolojileri
⚠️ Sınırlamalar
- Tek epoch ile eğitilmiştir (daha fazla eğitimle performans artırılabilir)
- 4-bit quantization kullanılmaktadır
- Görüntü işleme yetenekleri bulunmamaktadır (sadece metin tabanlı)
- Özellikle Türkçe için optimize edilmiştir
📖 Citation
Bu modeli kullanırsanız lütfen şu şekilde alıntılayın:
@misc{gemma3-4b-tr-2025,
author = {afkfatih},
title = {Gemma3-4B-TR: Turkish Fine-tuned Gemma 3 4B},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/afkfatih/Gemma3-4B-TR}
}
🙏 Teşekkürler
- Google - Temel Gemma 3 modelini açık kaynak olarak sunduğu için
- Unsloth - Verimli ve hızlı training framework'ü için (github.com/unslothai/unsloth)
- HuggingFace - TRL kütüphanesi ve platform desteği için
- Türkçe NLP Topluluğu - Destek ve motivasyon için
🔗 Linkler
- Model: huggingface.co/afkfatih/Gemma3-4B-TR
- Dataset: huggingface.co/datasets/afkfatih/turkish-gemma-51k
- Unsloth: github.com/unslothai/unsloth
- Downloads last month
- 13
Model tree for afkfatih/Gemma3-4B-TR
Base model
google/gemma-3-4b-pt