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") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("afkfatih/Gemma3-4B-TR") model = AutoModelForMultimodalLM.from_pretrained("afkfatih/Gemma3-4B-TR", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afkfatih/Gemma3-4B-TR", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afkfatih/Gemma3-4B-TR", "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 "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/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afkfatih/Gemma3-4B-TR", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- 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
- 261
Model tree for afkfatih/Gemma3-4B-TR
Base model
google/gemma-3-4b-pt