Instructions to use tahsinahsen/birag-gemma4-e2b-response-only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tahsinahsen/birag-gemma4-e2b-response-only with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tahsinahsen/birag-gemma4-e2b-response-only") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tahsinahsen/birag-gemma4-e2b-response-only") model = AutoModelForMultimodalLM.from_pretrained("tahsinahsen/birag-gemma4-e2b-response-only", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tahsinahsen/birag-gemma4-e2b-response-only with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tahsinahsen/birag-gemma4-e2b-response-only" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tahsinahsen/birag-gemma4-e2b-response-only", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tahsinahsen/birag-gemma4-e2b-response-only
- SGLang
How to use tahsinahsen/birag-gemma4-e2b-response-only 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 "tahsinahsen/birag-gemma4-e2b-response-only" \ --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": "tahsinahsen/birag-gemma4-e2b-response-only", "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 "tahsinahsen/birag-gemma4-e2b-response-only" \ --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": "tahsinahsen/birag-gemma4-e2b-response-only", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use tahsinahsen/birag-gemma4-e2b-response-only 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 tahsinahsen/birag-gemma4-e2b-response-only 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 tahsinahsen/birag-gemma4-e2b-response-only to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for tahsinahsen/birag-gemma4-e2b-response-only to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="tahsinahsen/birag-gemma4-e2b-response-only", max_seq_length=2048, ) - Docker Model Runner
How to use tahsinahsen/birag-gemma4-e2b-response-only with Docker Model Runner:
docker model run hf.co/tahsinahsen/birag-gemma4-e2b-response-only
BIRAG Gemma 4 E2B Response-Only
Türkçe
Model özeti
Bu repo, unsloth/gemma-4-E2B-it modelinin BIRAG Türkçe
response-only verisiyle LoRA yöntemi kullanılarak fine-tune edilmiş
ve ardından bağımsız 16-bit Safetensors ağırlıklarına birleştirilmiş
sürümüdür.
Modelin fine-tuning hedefi, kullanıcıya aşırı bağımlılığı teşvik etmeyen; sınırları koruyan, destekleyici ve özerkliği güçlendiren Türkçe yanıtlar üretmektir.
- Base model:
unsloth/gemma-4-E2B-it - Dataset:
tahsinahsen/birag-response-only-tr, revisionv0.4 - Eğitim yöntemi: response-only supervised fine-tuning
- Yayın biçimi: merged 16-bit full weights
- Doğrulanan eğitim context uzunluğu: 8192 token
- Yayın sürümü:
v0.1.0-validation
System ve user tokenları loss hesabında maskelenmiş, yalnızca görünür assistant yanıtları eğitilebilir label olarak bırakılmıştır. Veri seti thought/analysis kanalı içermez ve fine-tuning sırasında thinking modu hedeflenmemiştir.
Eğitim ayarları
| Ayar | Değer |
|---|---|
| Epoch | 3 |
| Optimizer step | 1344 |
| Train batch size | 1 |
| Gradient accumulation | 4 |
| Effective batch | 4 |
| Learning rate | 2e-4 |
| Scheduler | Linear |
| Warmup steps | 5 |
| Optimizer | AdamW 8-bit |
| Weight decay | 0.001 |
| Precision | BF16 |
| LoRA rank | 8 |
| LoRA alpha | 8 |
| LoRA hedefleri | Language attention/MLP projections |
| Gradient checkpointing | Enabled |
| Packing | Disabled |
| Seed | 3407 |
| Evaluation strategy | Epoch |
| Save strategy | Every 500 steps |
| Best-model reload | Disabled |
Eğitim ilk olarak 1 epoch tamamlanmış, aynı koşu checkpoint üzerinden
devam ettirilerek toplam 3 epoch ve 1344 optimizer step'e ulaşmıştır.
Yayınlanan adapter final checkpoint-1344 ile byte-level aynıdır.
Trainer load_best_model_at_end=False kullandığı için bu sürüm “best
checkpoint” olarak tanıtılmaz.
Validation-only LLM-as-Judge sonuçları
Bu sonuçlar yalnızca 225 kayıtlık validation split içindir. Test split değerlendirmesi değildir.
Judge: Qwen3.6 27B, Ollama, 16K context, iki yönlü sıralama.
| Sonuç | Base | Fine-tuned |
|---|---|---|
| Pairwise galibiyet | 35 | 133 |
| Galibiyet oranı | %15.56 | %59.11 |
| Overall ortalama | 3.718 | 4.487 |
| Kritik güvenlik işareti bulunan kayıt | 14 | 7 |
- Beraberlik: 57 (%25.33)
- Overall fark: +0.769
- %95 güven aralığı: [0.593, 0.942]
- Paired randomization: p < 0.001
- Sıra uyumu: 169 kayıt (%75.11)
- Sıra çatışması: 52 kayıt (%23.11)
Kritik güvenlik işaretleri otomatik judge çıktılarıdır; klinik güvenlik sertifikasyonu değildir.
Kullanım
from transformers import AutoProcessor, AutoModelForCausalLM
MODEL_ID = "tahsinahsen/birag-gemma4-e2b-response-only"
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
dtype="auto",
device_map="auto",
)
messages = [
{
"role": "system",
"content": "Türkçe, destekleyici ve özerkliği güçlendiren yanıt ver.",
},
{
"role": "user",
"content": "Kararlarımı verirken sürekli başkasının onayına ihtiyaç duyuyorum.",
},
]
text = processor.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
inputs = processor(
text=text,
return_tensors="pt",
).to(model.device)
input_length = inputs["input_ids"].shape[-1]
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=True,
temperature=1.0,
top_p=0.95,
top_k=64,
)
response = processor.decode(
outputs[0][input_length:],
skip_special_tokens=True,
)
print(response)
- Downloads last month
- -