Files
OrpoGemma-2-9B-TR/README.md
ModelHub XC 8d47490209 初始化项目,由ModelHub XC社区提供模型
Model: selimc/OrpoGemma-2-9B-TR
Source: Original Platform
2026-05-07 22:10:12 +08:00

273 lines
7.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
library_name: transformers
tags:
- Turkish
- TR
- ORPO
datasets:
- selimc/orpo-dpo-mix-TR-20k
language:
- tr
base_model:
- google/gemma-2-9b-it
license: gemma
model-index:
- name: OrpoGemma-2-9B-TR
results:
- task:
type: multiple-choice
dataset:
type: multiple-choice
name: MMLU_TR_V0.2
metrics:
- name: 5-shot
type: 5-shot
value: 0.530
verified: false
- task:
type: multiple-choice
dataset:
type: multiple-choice
name: Truthful_QA_V0.2
metrics:
- name: 0-shot
type: 0-shot
value: 0.543
verified: false
- task:
type: multiple-choice
dataset:
type: multiple-choice
name: ARC_TR_V0.2
metrics:
- name: 25-shot
type: 25-shot
value: 0.524
verified: false
- task:
type: multiple-choice
dataset:
type: multiple-choice
name: HellaSwag_TR_V0.2
metrics:
- name: 10-shot
type: 10-shot
value: 0.520
verified: false
- task:
type: multiple-choice
dataset:
type: multiple-choice
name: GSM8K_TR_V0.2
metrics:
- name: 5-shot
type: 5-shot
value: 0.648
verified: false
- task:
type: multiple-choice
dataset:
type: multiple-choice
name: Winogrande_TR_V0.2
metrics:
- name: 5-shot
type: 5-shot
value: 0.589
verified: false
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65281302cad797fc4abeffd7/Hqf7vdvp6dudVjN_bLKU_.png)
# OrpoGemma-2-9B-TR
OrpoGemma-2-9B-TR is a Turkish fine-tuned version of [google/gemma-2-9b-it](https://huggingface.co/google/gemma-2-9b-it). It is trained using the ORPO Trainer on a subset of 1500 rows from the dataset [selimc/orpo-dpo-mix-TR-20k](https://huggingface.co/datasets/selimc/orpo-dpo-mix-tr-20k).
## Training Information
- **Base Model**: [google/gemma-2-9b-it](https://huggingface.co/google/gemma-2-9b-it)
- **Fine-Tuning Technique**: ORPO
- **Training Data**: 1500 rows from [selimc/orpo-dpo-mix-TR-20k](https://huggingface.co/datasets/selimc/orpo-dpo-mix-tr-20k)
- **Training Time**: 2.5 hours on NVIDIA H100
### QLoRA Configurations:
- `lora_r`: 16
- `lora_alpha`: 32
- `lora_dropout`: 0.05
### ORPO Training Parameters
- `lr`: 2e-6
- `epochs`: 3
- `per_device_train_batch_size`: 8
- `gradient_accumulation_steps`: 4
## 📈 Training Curves
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65281302cad797fc4abeffd7/bdhWq-TbvQ-h_aSQDf2pv.png)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65281302cad797fc4abeffd7/mKdVsAjBdsmMMhXorKVoV.png)
## OpenLLMTurkishLeaderboard_v0.2 Results
| Dataset | Score |
|-----------------------|--------|
| MMLU_TR_V0.2 | 53.0% |
| Truthful_QA_TR_V0.2 | 54.3% |
| ARC_TR_V0.2 | 52.4% |
| HellaSwag_TR_V0.2 | 52.0% |
| GSM8K_TR_V0.2 | 64.8% |
| Winogrande_TR_V0.2 | 58.9% |
| **Average** | **55.9%** |
Thanks to the [WiroAI](https://huggingface.co/WiroAI) team for evaluating my model. Evaluations were done without any inference engine.
## Model Capabilities
- Produces fluent, coherent, and contextually appropriate text in Turkish.
- Delivers detailed and informative responses to a wide range of instructions and question types.
- May still produce incorrect or nonsensical outputs, user verification is recommended.
## How to Use
```python
from transformers import pipeline, BitsAndBytesConfig, AutoTokenizer
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model_id = "selimc/OrpoGemma-2-9B-TR"
tokenizer = AutoTokenizer.from_pretrained(model_id)
pipe = pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16 ,'quantization_config': bnb_config},
tokenizer=tokenizer,
device_map="auto"
)
messages = [
{"role": "user", "content": "Gökyüzü neden mavi?"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(
prompt,
max_new_tokens=512,
do_sample=True,
eos_token_id=[pipe.tokenizer.convert_tokens_to_ids("<end_of_turn>"), pipe.tokenizer.eos_token_id],
temperature=0.67,
)
generated_text = outputs[0]['generated_text']
response = generated_text[len(prompt):]
print(response)
```
### Example 1
```python
messages = [
{"role": "user", "content": """Bir web sayfasından tüm URLleri çeken bir Python fonksiyonu yazın ve nasıl çalıştığınııklayın."""},
]
```
``````
Bir web sayfasından tüm URLleri çeken bir Python fonksiyonu yazalım ve nasıl çalıştığınııklayalım.
```python
import requests
def get_urls_from_page(url):
"""
Bir web sayfasından tüm URL'leri çeker.
Args:
url (str): Web sayfasının URL'i.
Returns:
list: Web sayfasındaki tüm URL'ler.
"""
response = requests.get(url)
response.raise_for_status()
urls = []
for link in response.html.find_all('a', href=True):
urls.append(link['href'])
return urls
# Örnek kullanım
web_page_url = 'https://www.example.com/'
all_urls = get_urls_from_page(web_page_url)
print(f"Bu web sayfasındaki {len(all_urls)} URL bulunmaktadır:\n{all_urls}")
```
**Fonksiyonun nasıl çalıştığı:**
1. **`requests` kütüphanesini içer:** Bu kütüphane web sayfalarına erişmek için kullanılır.
2. **`get_urls_from_page` fonksiyonunu tanımla:**
* Bu fonksiyon, bir web sayfasının URL'ini alır.
* `requests.get()` kullanarak web sayfasına erişir ve `response.raise_for_status()` kullanarak HTTP durum kodunun 200-399 aralığında olup olmadığını kontrol eder.
* `response.html` içine bir HTML belgesini saklar.
* `response.html.find_all('a', href=True)` kullanarak, `href` atributuna sahip tüm `<a>` etiketlerini bulur.
* `urls` listesine URL'leri ekler.
* `urls` listesini döndürür.
3. **Örnek kullanım:**
* `web_page_url` değişkenine bir web sayfasının URL'ini atar.
* `get_urls_from_page` fonksiyonunu kullanarak web sayfasından tüm URL'leri çeker.
* `all_urls` listesini `print()` fonksiyonu kullanarak ekrana yazdır
``````
### Example 2
```python
messages = [
{
"role": "system",
"content":
"""
Sen bir türkçe bilmece ustasısın. Görevin:
- Sorulan bilmecelere mantıklı ve doğru cevaplar vermek
- Bilmecenin çözümünü adım adım açıklamak
"""
},
{
"role": "user",
"content":
"""
Kanadı var, kuş değil.
Suda yüzer, gemi değil.
Kuyruğu var, kedi değil.
Bil bakalım, bu nedir?
"""
},
]
```
```
Kanadı var, kuş değil, suda yüzer, gemi değil, kuyruğu var, kedi değil... Bu bir **balık**! 🐟
```
## Citation
```bibtex
@misc{orpogemma2-9b-tr,
author = {Selim Çavaş},
title = {OrpoGemma-2-9B-TR: Turkish Fine-tuned Gemma Model},
year = {2024},
url = {https://huggingface.co/selimc/OrpoGemma-2-9B-TR}
}
```