Instructions to use SykoSLM/SykoLLM-V6.9-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use SykoSLM/SykoLLM-V6.9-SFT with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
File size: 6,311 Bytes
dea5b88 401c951 dea5b88 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | ---
license: apache-2.0
base_model: SykoSLM/SykoLLM-v6.9
tags:
- phi3
- lora
- peft
- sft
- instruction-tuning
- text-generation
language:
- tr
pipeline_tag: text-generation
---
# SykoLLM-V6.9-SFT
**SykoLLM-V6.9-SFT**, [`SykoSLM/SykoLLM-v6.9`](https://huggingface.co/SykoSLM/SykoLLM-v6.9) temel modelinin, Alpaca formatlı bir talimat (instruction) veri seti üzerinde **LoRA (Low-Rank Adaptation)** yöntemiyle ince ayar yapılıp, ardından adaptör ağırlıklarının taban model ile birleştirilmesiyle (merge) elde edilmiş halidir.
## Model Detayları
| Özellik | Değer |
|---|---|
| Mimari | Phi3ForCausalLM |
| Gizli katman boyutu (hidden_size) | 1024 |
| Katman sayısı (num_hidden_layers) | 24 |
| Dikkat başlığı sayısı (num_attention_heads) | 8 |
| Key/Value başlığı sayısı (num_key_value_heads) | 2 |
| Ara katman boyutu (intermediate_size) | 3072 |
| Kelime dağarcığı (vocab_size) | 50,000 |
| Maksimum pozisyon (max_position_embeddings) | 1024 |
| Aktivasyon fonksiyonu | SiLU |
| Veri tipi | float16 |
## İnce Ayar (Fine-Tuning) Bilgileri
Model, taban ağırlıklar dondurulmuş şekilde yalnızca LoRA adaptör katmanları eğitilerek fine-tune edilmiştir:
```
trainable params: 24,379,392 || all params: 416,236,544 || trainable%: 5.8571
```
- **Toplam parametre sayısı:** ~416.2M
- **Eğitilebilir (LoRA) parametre sayısı:** ~24.4M
- **Eğitilebilir oran:** %5.86
- **Yöntem:** LoRA → eğitim sonrası `merge_and_unload()` ile taban modele birleştirildi
- **Veri seti formatı:** Alpaca (instruction / input / output)
> Not: Yukarıdaki istatistikler yalnızca LoRA eğitim aşamasına aittir; bu repodaki ağırlıklar zaten birleştirilmiş (merged) haldedir, ayrıca bir adaptör yüklemeye gerek yoktur.
## Kullanım
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "SykoSLM/SykoLLM-V6.9-SFT"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
)
prompt = """### Talimat:
Türkiye'nin başkenti neresidir?
### Cevap:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=128,
do_sample=True,
temperature=0.5,
top_p=0.9,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
## Karşılaştırmalı Inference Scripti (Base Model vs LoRA)
Base model ile LoRA adaptörünün yan yana karşılaştırılması için:
```python
"""
Inference Script — SykoSLM/SykoLLM-v6.9 + LoRA Adapter
Base model ve LoRA'lı halini yan yana karşılaştırır.
Gereksinimler:
pip install transformers peft torch --break-system-packages
"""
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE_MODEL_NAME = "SykoSLM/SykoLLM-v6.9"
ADAPTER_PATH = "/kaggle/working/sykollm-lora-alpaca/final_adapter"
MAX_NEW_TOKENS = 200
TEMPERATURE = 0.5
TOP_P = 0.9
REPETITION_PENALTY = 1.0
NO_REPEAT_NGRAM_SIZE = 0
TEST_INSTRUCTIONS = [
"hello!",
"Explain what a black hole is in simple terms.",
"Write a short poem about autumn.",
"What is the capital of France?",
"Give me three tips for staying productive while working from home.",
"What is the capital of Turkey?",
]
print("Tokenizer yükleniyor...")
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL_NAME, trust_remote_code=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
print("Base model yükleniyor...")
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL_NAME,
trust_remote_code=True,
torch_dtype=torch.float32,
device_map="auto",
)
base_model.eval()
print("LoRA adaptörü yükleniyor...")
lora_model = PeftModel.from_pretrained(base_model, ADAPTER_PATH)
lora_model.eval()
def format_prompt(instruction, input_text=""):
if input_text:
return (
f"### Instruction:\n{instruction}\n\n"
f"### Input:\n{input_text}\n\n"
f"### Response:\n"
)
return f"### Instruction:\n{instruction}\n\n### Response:\n"
def generate(model, prompt, max_new_tokens=MAX_NEW_TOKENS):
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
temperature=TEMPERATURE,
top_p=TOP_P,
repetition_penalty=REPETITION_PENALTY,
no_repeat_ngram_size=NO_REPEAT_NGRAM_SIZE,
do_sample=True,
pad_token_id=tokenizer.pad_token_id,
)
full_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
if "### Response:" in full_text:
return full_text.split("### Response:")[-1].strip()
return full_text[len(prompt):].strip()
if __name__ == "__main__":
for instruction in TEST_INSTRUCTIONS:
prompt = format_prompt(instruction)
print("\n" + "=" * 80)
print(f"INSTRUCTION: {instruction}")
print("=" * 80)
print("\n[BASE MODEL — LoRA'sız]")
base_output = generate(base_model, prompt)
print(base_output)
print("\n[LoRA'LI MODEL]")
lora_output = generate(lora_model, prompt)
print(lora_output)
print("\n" + "=" * 80)
print("Test tamamlandı.")
```
## Eğitim Şablonu (Alpaca Formatı)
```
### Talimat:
{instruction}
### Girdi:
{input}
### Cevap:
{output}
```
## Sınırlamalar
- Model küçük ölçekli olduğu için (~416M parametre) karmaşık akıl yürütme gerektiren görevlerde sınırlı performans gösterebilir.
- Üretilen çıktılar yanlış, tutarsız veya önyargılı bilgi içerebilir; kritik kararlarda doğrulanmadan kullanılmamalıdır.
- `max_position_embeddings` değeri 1024 olduğundan çok uzun bağlamlarda kesilme yaşanabilir.
## Lisans
Bu model kartında lisans olarak `apache-2.0` varsayılan olarak belirtilmiştir. Taban modelin (`SykoSLM/SykoLLM-v6.9`) lisansına göre bu alanı güncellemeniz gerekebilir.
## Atıf
```bibtex
@misc{sykollm-v69-sft,
title = {SykoLLM-V6.9-SFT},
author = {SykoSLM},
year = {2026},
note = {LoRA fine-tuned and merged from SykoSLM/SykoLLM-v6.9}
}
```
|