OrpoGemma-2-9B-TR
OrpoGemma-2-9B-TR is a Turkish fine-tuned version of 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.
Training Information
Base Model: google/gemma-2-9b-it
Fine-Tuning Technique: ORPO
Training Data: 1500 rows from selimc/orpo-dpo-mix-TR-20k
Training Time: 2.5 hours on NVIDIA H100
QLoRA Configurations:
lora_r
: 16lora_alpha
: 32lora_dropout
: 0.05
ORPO Training Parameters
lr
: 2e-6epochs
: 3per_device_train_batch_size
: 8gradient_accumulation_steps
: 4
π Training Curves
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 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
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
messages = [
{"role": "user", "content": """Bir web sayfasΔ±ndan tΓΌm URLβleri Γ§eken bir Python fonksiyonu yazΔ±n ve nasΔ±l Γ§alΔ±ΕtΔ±ΔΔ±nΔ± aΓ§Δ±klayΔ±n."""},
]
Bir web sayfasΔ±ndan tΓΌm URLβleri Γ§eken bir Python fonksiyonu yazalΔ±m ve nasΔ±l Γ§alΔ±ΕtΔ±ΔΔ±nΔ± aΓ§Δ±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
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
@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}
}
- Downloads last month
- 2,706
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
the model is not deployed on the HF Inference API.
Model tree for selimc/OrpoGemma-2-9B-TR
Dataset used to train selimc/OrpoGemma-2-9B-TR
Evaluation results
- 5-shot on MMLU_TR_V0.2self-reported0.530
- 0-shot on Truthful_QA_V0.2self-reported0.543
- 25-shot on ARC_TR_V0.2self-reported0.524
- 10-shot on HellaSwag_TR_V0.2self-reported0.520
- 5-shot on GSM8K_TR_V0.2self-reported0.648
- 5-shot on Winogrande_TR_V0.2self-reported0.589