Downloads · 30 days
6
14% of all-time downloads
sedatyilmazer/kanunlar
kanunlar is a text generation model from sedatyilmazer. Use it when you need the model to write or continue text. It is set up for transformers.
This model is a fineuned qwen3.5:9B with a turkish law dataset (sedatyilmazer/Kanunlar)
Downloads · 30 days
6
14% of all-time downloads
All-time downloads
42
Public
Parameters
9B
17.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors17.9 GB · 100%
From the Hugging Face model README
This model is a fineuned qwen3.5:9B with a turkish law dataset (sedatyilmazer/Kanunlar)
!pip install git+https://github.com/huggingface/transformers.git -U
!pip install accelerate peft -U
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# --- YAPILANDIRMA ---
# Yeni oluşturduğun modelin Hugging Face ID'si
model_id = "sedatyilmazer/kanunlar"
def run_kanunlar_inference():
print(f"🚀 Blackwell GPU üzerinde '{model_id}' yükleniyor...")
try:
# 1. Tokenizer ve Model Yükleme
# Blackwell mimarisi için torch_dtype=torch.bfloat16 en verimli tercihtir.
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
print("✅ Model başarıyla yüklendi! Sorgu işleniyor...")
# 2. Test Sorusu (Prompt)
# Qwen modelleri genellikle ChatML formatını (<|im_start|>) sever.
user_query = "KVKK nedir?"
prompt = f"<|im_start|>user\n{user_query}<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# 3. Yanıt Üretme (Generation)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=32000, # Blackwell'de bellek sorunu olmadığı için yüksek tutabilirsin
temperature=0.3, # Hukuk metinlerinde tutarlılık için düşük sıcaklık
top_p=0.9,
repetition_penalty=1.1,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
# 4. Çıktıyı Decode Etme
response = tokenizer.decode(output_ids[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
print("\n" + "="*60)
print(f"SORU: {user_query}")
print("-" * 60)
print(f"KANUNLAR YANITI:\n\n{response}")
print("="*60)
except Exception as e:
print(f"❌ HATA: {str(e)}")
# Testi Başlat
run_kanunlar_inference()
sedatyilmazer/Kanunlar