Instructions to use halilneed/turkish-pii-detection-v01 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use halilneed/turkish-pii-detection-v01 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="halilneed/turkish-pii-detection-v01") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("halilneed/turkish-pii-detection-v01") model = AutoModelForCausalLM.from_pretrained("halilneed/turkish-pii-detection-v01", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use halilneed/turkish-pii-detection-v01 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "halilneed/turkish-pii-detection-v01" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "halilneed/turkish-pii-detection-v01", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/halilneed/turkish-pii-detection-v01
- SGLang
How to use halilneed/turkish-pii-detection-v01 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "halilneed/turkish-pii-detection-v01" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "halilneed/turkish-pii-detection-v01", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "halilneed/turkish-pii-detection-v01" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "halilneed/turkish-pii-detection-v01", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use halilneed/turkish-pii-detection-v01 with Docker Model Runner:
docker model run hf.co/halilneed/turkish-pii-detection-v01
halilatasoy/turkish-pii-detection-v01
Gemma-3-270m-it tabanlı Türkçe PII maskeleme modeli; zayıf dilimleri hedefleyen sentetik Türkçe bankacılık/ERP verisiyle devam eğitimi (continued full fine-tune) ile üretildi. 53 PII etiketi, talimat-koşullu maskeleme (tam / beyaz liste / kara liste / kapsam dışı).
Kod, veri üreteci ve değerlendirme: https://github.com/halilatasoy/turkish-pii-guard
Benchmark (halka açık 1000 satırlık Türkçe PII maskeleme benchmark'ı, satır düzeyi tam eşleşme)
| Model | Tam eşleşme (1000) | Şema-nötr (903) |
|---|---|---|
| taban model (270m) | 0.743 | 0.773 |
| bu model | 0.882 | 0.902 |
Kategori: beyaz_liste 0.900 · kapsam_disi 0.960 · kara_liste 0.893 · negatif 0.865 · tam 0.854
Zor dilimler: caps 0.802 · cok_kisi 0.600 · duz 0.930 · ekli 0.758 · kayit 0.976 · olmayan_etiket_talebi 0.917 · sozle 0.946 · tuzak 0.865 · uzun 0.656
Eğitim: 24.000 sentetik örnek, 1 epoch, full fine-tune, lr 5e-5,dk. Benchmark yalnızca test için kullanıldı; eğitim kalıpları benchmark cümle ve talimat kalıplarından bağımsız yazıldı, benchmark girdileriyle çakışan satırlar üretimde atıldı.
Kullanım
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL = "halilatasoy/turkish-pii-detection-v01"
tokenizer = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(MODEL, dtype=torch.bfloat16, device_map="auto").eval()
def maskele(metin, talimat="Metindeki tüm kişisel verileri uygun etiketlerle maskele."):
prompt = (f"{tokenizer.bos_token}<start_of_turn>user\n{talimat}\n\n"
f"Metin: {metin}<end_of_turn>\n<start_of_turn>model\n")
girdi = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
with torch.inference_mode():
cikti = model.generate(**girdi, max_new_tokens=512, do_sample=False,
eos_token_id=tokenizer.convert_tokens_to_ids("<end_of_turn>"),
pad_token_id=tokenizer.eos_token_id)
return tokenizer.decode(cikti[0, girdi["input_ids"].shape[1]:], skip_special_tokens=True).strip()
print(maskele("müşteri Ayşe Yılmaz tc 12345678901 tel 0532 111 22 33"))
# -> müşteri [AD] tc [TCKN] tel [TEL]
Sınırlar
Değerlendirme sentetik veriyle yapılmıştır; gerçek kullanıcı metninde ölçmeden üretime alınmamalıdır. Şema dışı etiket üretebilir (53 etiketlik whitelist önerilir). KVKK/GDPR sorumluluğu kullanandadır. Lisans: Gemma Terms of Use.
- Downloads last month
- 418