---
library_name: transformers
tags:
- unsloth
- trl
- grpo
base_model:
- Qwen/Qwen2.5-7B-Instruct
---
# Qwen2.5-7B-Instruct-OpenR1-Turkish
## Model Description
**Qwen2.5-7B-Instruct-OpenR1-Turkish** is a **7B-parameter Turkish instruction-tuned** language model, fine-tuned using **GRPO (Group Relative Policy Optimization) techniques** for **better efficiency and response quality**.
## Model Details
- **Base Model**: Qwen2.5-7B-Instructions
- **Fine-tuned with GRPO and LoRa (Low-Rank Adaptation)**
- **Context Window**: 4096 tokens
- **The first model was fine-tuned on an L4 GPU for 50 hours and achieved a score of 51/100(answer) on the gsm8k-tr dataset.
After additional fine-tuning on an A1000 GPU for 10 more hours, its score improved to 57/100(answer) on the same dataset.**
## Usage
### Install Dependencies
```bash
%%capture
# Skip restarting message in Colab
import sys; modules = list(sys.modules.keys())
for x in modules: sys.modules.pop(x) if "PIL" in x or "google" in x else None
!pip install unsloth vllm
!pip install --upgrade pillow
```
```
from unsloth import FastLanguageModel
from unsloth import is_bfloat16_supported
import torch
# Model parameters
max_seq_length = 4096
# Load the model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="erythropygia/Qwen2.5-7B-Instruct-OpenR1-Turkish",
max_seq_length=max_seq_length,
load_in_4bit=True,
fast_inference=True,
#gpu_memory_utilization=0.35, # Adjust based on your GPU's
)
# Example input
SYSTEM_PROMPT = """
Aşağıdaki formatta cevap ver:
- Cevap verirken, etiketleri arasına kullanıcının sorusunu çözmek için izlediğin mantıklı adımları ve akıl yürütme sürecini açıkça belirt.
- etiketleri arasına ise, akıl yürütme aşamasından elde ettiğin sonuçlara dayanarak kullanıcıya uygun bir yanıt ver.
Buraya, soruyu çözerken düşündüğün mantıklı adımları yaz. Her adımda neyi neden yapacağını belirt.
Burada ise soruya net ve doğru bir yanıt ver. Yanıt, kısmında belirtilen mantıklı adımlara dayanmalı.
"""
text = tokenizer.apply_chat_template([
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "f(x) = x^(x^2) + ln(x^2 + 1)^(sin(x)) fonksiyonunun türevi nedir?"},
], tokenize=False, add_generation_prompt=True)
from vllm import SamplingParams
# Sampling parameters
sampling_params = SamplingParams(
temperature=0.8,
top_p=0.95,
max_tokens=4096,
)
# Generate response
output = model.fast_generate(
[text],
sampling_params=sampling_params,
lora_request=None,
)[0].outputs[0].text
print(output)
```
## Response:
```
Bu soruyu çözerken, iki ayrı terim var: x^(x^2) ve ln(x^2 + 1)^(sin(x)). Her birini ayrı ayrı türev almaya çalışacağım.
1. x^(x^2) teriminin türevini almak için, taban ve kuvvet hemde değişken olduğundan, logaritmik türevi kullanacağım.
2. ln(x^2 + 1)^(sin(x)) teriminin türevini almak için, iç ve dış fonksiyonların türevlerini ve zincir kuralını kullanacağım.
Bununla birlikte, her iki terim de x'den bağlı olduğundan, türevlerini de x'ye göre alacağım.
f(x) = x^(x^2) + ln(x^2 + 1)^(sin(x)) fonksiyonunun türevi:
1. x^(x^2) teriminin türevi için logaritmik türev kullanalım:
x^(x^2) = e^(x^2 * ln(x))
Türevi: e^(x^2 * ln(x)) * d/dx (x^2 * ln(x)) = x^(x^2) * (2x * ln(x) + x^2 * (1/x))
2. ln(x^2 + 1)^(sin(x)) teriminin türevi için zincir kuralını kullanalım:
ln(x^2 + 1)^(sin(x)) = sin(x) * ln(x^2 + 1)
Türevi: sin(x) * d/dx (ln(x^2 + 1)) + ln(x^2 + 1) * d/dx (sin(x)) = sin(x) * (2x / (x^2 + 1)) + ln(x^2 + 1) * cos(x)
Buna göre, f'(x) = x^(x^2) * (2x * ln(x) + x^2 * (1/x)) + sin(x) * (2x / (x^2 + 1)) + ln(x^2 + 1) * cos(x)
```