Downloads · 30 days
9
30% of all-time downloads
emirunlu26/qwen3-4B-finetuned-turkish-youtube-text-summarizer
qwen3-4B-finetuned-turkish-youtube-text-summarizer is a summarization model from emirunlu26. Use it when you need a shorter version of a longer text. It is set up for peft. The card lists the license as apache-2.0.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
9
30% of all-time downloads
All-time downloads
30
Public
Repo size
139 MB
Likes
0
Public
Click a slice to open those files.
.safetensors63.7 MB · 80%
From the Hugging Face model README
This model is a fine-tuned version of Qwen/Qwen3-4B on emirunlu26/turkish-youtube-text-summarization dataset.
from transformers import AutoModelForCausalLM,AutoTokenizer
from peft import PeftModel
import torch
base_model_name = "Qwen/Qwen3-4B"
adapter_model_name = "emirunlu26/qwen3-4B-finetuned-turkish-youtube-text-summarizer"
base_model = AutoModelForCausalLM.from_pretrained(base_model_name,device_map="cuda",torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
model = PeftModel.from_pretrained(base_model, adapter_model_name).to("cuda")
model.eval()
def generate_prompt(sample):
instruction_prompt = "Bu Youtube videosunu, ana teması ve önemli noktalarına odaklanarak kısa ama öz ve soyutlayıcı bir şekilde özetle (abstractive summary):\n"
title = sample["title"]
category = sample["category"]
channel = sample["channel"]
text = sample["text"]
data_prompt = f"Başlık: {title}\n" \
+ f"Kategori: {category}\n" \
+ f"Kanal: {channel}\n" \
+ f"Metin: {text}"
return (instruction_prompt + data_prompt)
def preprocess_sample(sample):
prompt = generate_prompt(sample)
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False
)
model_input = tokenizer([text],return_tensors="pt").to(model.device)
return model_input
def generate_summary(model,model_input):
generated_ids = model.generate(
**model_input,
max_new_tokens=2000
)
output_ids = generated_ids[0][len(model_input.input_ids[0]):].tolist()
summary = tokenizer.decode(output_ids,skip_special_tokens=True).strip("\n")
return summary
video_sample = {"title":<title>, "category":<category_name>, "channel":<channel_name>}
model_input = preprocess_sample(video_sample)
summary = generate_summary(model,model_input)
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 15.3721 | 0.1923 | 50 | 12.8846 |
| 10.2132 | 0.3846 | 100 | 8.7292 |
| 8.1384 | 0.5769 | 150 | 7.7720 |
| 7.5919 | 0.7692 | 200 | 7.5426 |
| 7.4479 | 0.9615 | 250 | 7.4566 |
| 7.4262 | 1.1538 | 300 | 7.4169 |
| 7.397 | 1.3462 | 350 | 7.3958 |
| 7.3622 | 1.5385 | 400 | 7.3824 |
| 7.3669 | 1.7308 | 450 | 7.3723 |
| 7.3221 | 1.9231 | 500 | 7.3672 |