Instructions to use tugrulbayrak/TurnTurk-Gpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tugrulbayrak/TurnTurk-Gpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tugrulbayrak/TurnTurk-Gpt")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tugrulbayrak/TurnTurk-Gpt") model = AutoModelForCausalLM.from_pretrained("tugrulbayrak/TurnTurk-Gpt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tugrulbayrak/TurnTurk-Gpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tugrulbayrak/TurnTurk-Gpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tugrulbayrak/TurnTurk-Gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tugrulbayrak/TurnTurk-Gpt
- SGLang
How to use tugrulbayrak/TurnTurk-Gpt 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 "tugrulbayrak/TurnTurk-Gpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tugrulbayrak/TurnTurk-Gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "tugrulbayrak/TurnTurk-Gpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tugrulbayrak/TurnTurk-Gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tugrulbayrak/TurnTurk-Gpt with Docker Model Runner:
docker model run hf.co/tugrulbayrak/TurnTurk-Gpt
TurnTurk-GPT
English: TurnTurk-GPT is a text-based turn-taking model for Turkish. Given the words of a two-party conversation, it estimates after every word the probability that the current speaker has finished their turn, P(<ts> | context). It follows the TurnGPT approach on the Turkish GPT-2 backbone ytu-ce-cosmos/turkish-gpt2: a turn-shift token <ts> and two speaker tokens <sp1> / <sp2> are added to the vocabulary, and the model is trained with the causal language modelling objective. The model is pre-trained on Syn-TurnTurk and fine-tuned on Real-TurnTurk. Input is lower-cased text without punctuation, matching the output of streaming speech recognisers.
Türkçe: TurnTurk-GPT, Türkçe için metin tabanlı bir sıra alma (turn-taking) modelidir. İki kişilik bir konuşmanın kelimeleri verildiğinde, her kelimeden sonra konuşmacının sırasını bitirmiş olma olasılığını, P(<ts> | bağlam), tahmin eder. Model, Türkçe GPT-2 gövdesi ytu-ce-cosmos/turkish-gpt2 üzerinde TurnGPT yaklaşımını izler: sözlüğe sıra sonu token'ı <ts> ile iki konuşmacı token'ı <sp1> / <sp2> eklenmiş ve model nedensel dil modelleme hedefiyle eğitilmiştir. Model Syn-TurnTurk üzerinde ön-eğitilmiş ve Real-TurnTurk üzerinde ince ayarlanmıştır. Girdi, akış halindeki konuşma tanıma (ASR) çıktısıyla uyumlu olarak küçük harfli ve noktalamasız metindir.
Use Cases / Kullanım Alanları
English:
- End-of-turn detection for Turkish voice agents built on speech recognition
- Deciding when to respond at a detected silence, in combination with a voice activity detector
- Incremental, word-by-word scoring of live transcripts
- A baseline for research on Turkish turn-taking prediction
Türkçe:
- Konuşma tanıma tabanlı Türkçe sesli asistanlarda sıra sonu tespiti
- Bir ses aktivitesi dedektörüyle birlikte, algılanan sessizlikte yanıt verme kararı
- Canlı transkriptlerin kelime kelime, artımlı olarak puanlanması
- Türkçe sıra alma tahmini araştırmaları için karşılaştırma modeli
Model Summary / Model Özeti
| Property / Özellik | Value / Değer |
|---|---|
| Architecture / Mimari | GPT-2 (GPT2LMHeadModel) |
| Parameters / Parametre | 124M |
| Backbone / Gövde | ytu-ce-cosmos/turkish-gpt2 |
| Added tokens / Eklenen token'lar | <ts>, <sp1>, <sp2> |
| Context window / Bağlam penceresi | 256 tokens |
| Input / Girdi | lower-cased, no punctuation / küçük harf, noktalamasız |
| Output / Çıktı | P(<ts>) after each word / her kelimeden sonra P(<ts>) |
| Recommended threshold / Önerilen eşik | 0.127 |
| CPU latency / CPU gecikmesi | ~55 ms per word with KV cache (2 cores) / KV önbellekle kelime başına ~55 ms (2 çekirdek) |
| Language / Dil | Turkish / Türkçe |
Training / Eğitim
| Stage / Aşama | Data / Veri | Steps / Adım | Learning rate |
|---|---|---|---|
| 1. Synthetic pre-training / Sentetik ön-eğitim | Syn-TurnTurk: 1,625 dialogues, 14,185 turns | up to 1,200 | 5e-5 |
| 2. Real fine-tuning / Gerçek veriyle ince ayar | Real-TurnTurk: 6 conversations, 578 turns, 15,531 words | up to 400 | 3e-5 |
English: Optimisation uses AdamW with weight decay 0.01, a linear schedule with 10% warm-up, gradient clipping at 1.0, mixed precision and early stopping on held-out windows. Training windows of 256 tokens overlap by half. Embeddings of the added tokens are initialised at the mean of the existing embeddings. The released model is fine-tuned on all six real conversations.
Türkçe: Optimizasyonda 0.01 ağırlık azaltmalı AdamW, %10 ısınmalı doğrusal öğrenme oranı planı, 1.0'da gradyan kırpma, karma hassasiyet ve ayrılmış pencereler üzerinde erken durdurma kullanılmıştır. 256 token'lık eğitim pencereleri yarı yarıya örtüşür. Eklenen token'ların gömmeleri mevcut gömmelerin ortalamasıyla başlatılmıştır. Yayımlanan model altı gerçek konuşmanın tamamıyla ince ayarlanmıştır.
Evaluation / Değerlendirme
English: Every word of Real-TurnTurk is a decision point, labelled positive if it ends its turn (15,522 points, 578 positive; a random predictor scores AP 0.037). Results come from leave-one-recording-out cross-validation averaged over three seeds, with recording-level 95% bootstrap intervals. The primary metric is average precision (AP).
Türkçe: Real-TurnTurk'teki her kelime bir karar noktasıdır ve sırasını bitiriyorsa pozitif etiketlenir (15.522 nokta, 578 pozitif; rastgele tahmin AP 0.037). Sonuçlar, üç tohumun ortalaması alınarak her seferinde bir kaydın dışarıda bırakıldığı çapraz doğrulamadan gelir; güven aralıkları kayıt düzeyinde %95 bootstrap aralıklarıdır. Ana metrik ortalama kesinliktir (AP).
Main Results / Ana Sonuçlar
| System / Sistem | AP | 95% CI | AUC | F1 |
|---|---|---|---|---|
| TurnTurk-GPT | 0.148 | [0.132, 0.167] | 0.783 | 0.219 |
Zero-shot turkish-gpt2, P(newline) |
0.130 | [0.103, 0.154] | 0.787 | 0.195 |
| LiveKit multilingual turn detector | 0.100 | [0.081, 0.118] | 0.686 | 0.132 |
| Turn-length prior / Sıra uzunluğu önsel | 0.049 | [0.036, 0.064] | 0.572 | 0.089 |
| Random / Rastgele | 0.037 | [0.028, 0.051] | 0.500 | 0.072 |
TurnTurk-GPT outperforms the LiveKit multilingual detector by +0.048 AP when the test recording is unseen and by +0.020 AP when the test speakers are unseen; both differences are significant under a paired cluster bootstrap. / TurnTurk-GPT, test kaydı eğitimde yokken LiveKit çok dilli dedektörünü +0.048 AP, test konuşmacıları eğitimde yokken +0.020 AP farkla geçer; iki fark da eşleştirilmiş küme bootstrap testinde anlamlıdır.
Operating Point at 70% Recall / %70 Duyarlılıkta Çalışma Noktası
| System / Sistem | Precision / Kesinlik | False alarms per hit / Doğru başına yanlış alarm | False alarms on pre-pause words / Duraklama öncesi yanlış alarm |
|---|---|---|---|
| TurnTurk-GPT | 0.095 | 9.6 | 51.7% |
| LiveKit multilingual turn detector | 0.059 | 16.0 | 65.4% |
At the same recall, TurnTurk-GPT produces about six fewer false alarms per correct detection than the multilingual detector. / Aynı duyarlılıkta TurnTurk-GPT, çok dilli dedektöre göre doğru tespit başına yaklaşık altı daha az yanlış alarm üretir.
Turkish Morphology / Türkçe Biçimbilim
Removing the suffixes of the turn-final word lowers AP by 44%, whereas the same operation on a sentence-internal word changes it by 2%: the model reads the end-of-turn cue from the suffixes of the clause-final verb. / Sıra sonundaki kelimenin ekleri çıkarıldığında AP %44 düşer; aynı işlem cümle içindeki bir kelimeye uygulandığında değişim %2'dir: model sıra sonu ipucunu cümle sonundaki fiilin eklerinden okur.
Usage / Kullanım
import re, unicodedata, torch
from transformers import AutoTokenizer, AutoModelForCausalLM
REPO = "tugrulbayrak/TurnTurk-Gpt"
tok = AutoTokenizer.from_pretrained(REPO)
model = AutoModelForCausalLM.from_pretrained(REPO).eval()
TS, SP1, SP2 = (tok.convert_tokens_to_ids(t) for t in ("<ts>", "<sp1>", "<sp2>"))
_TR = str.maketrans({"I": "ı", "İ": "i", "Ş": "ş", "Ğ": "ğ", "Ü": "ü", "Ö": "ö", "Ç": "ç"})
def normalize(s):
s = unicodedata.normalize("NFC", s).translate(_TR).lower().replace("’", "").replace("'", "")
s = re.sub(r"[^a-zçğıöşü0-9 ]+", " ", s)
return re.sub(r"\s+", " ", s).strip()
def turn_end_probs(turns):
"""turns: [(speaker, text), ...] -> [(speaker, word, P(turn end)), ...]"""
ids, tt, spk, out = [TS], [SP1], {}, []
for who, text in turns:
sp = (SP1, SP2)[spk.setdefault(who, len(spk) % 2)]
for w in normalize(text).split():
piece = tok((" " if ids[-1] != TS else "") + w, add_special_tokens=False)["input_ids"]
ids += piece; tt += [sp] * len(piece); out.append((who, w, len(ids) - 1))
ids.append(TS); tt.append(sp)
off = max(0, len(ids) - 256)
with torch.no_grad():
logits = model(input_ids=torch.tensor([ids[off:]]),
token_type_ids=torch.tensor([tt[off:]])).logits[0]
p = torch.softmax(logits.float(), -1)[:, TS]
return [(who, w, float(p[i - off])) for who, w, i in out if i >= off]
dialogue = [("A", "Hafta sonu ne yaptın?"),
("B", "Ailemi ziyarete gittim, çok güzel geçti.")]
for who, w, p in turn_end_probs(dialogue):
print(f"{who} {w:12} {p:.3f}")
English: The sequence starts with <ts> and every completed turn is closed with <ts>. Speaker identity is passed through token_type_ids using the ids of <sp1> and <sp2>. To score the ongoing turn of a live conversation, pass the completed turns followed by the current partial turn; the probability after its last word is the end-of-turn score. A turn end is predicted when the score exceeds the threshold in turnturk_config.json (0.127). In a voice agent, the score is typically queried when the voice activity detector reports silence.
Türkçe: Dizi <ts> ile başlar ve tamamlanan her sıra <ts> ile kapatılır. Konuşmacı kimliği, <sp1> ve <sp2> token id'leri kullanılarak token_type_ids ile verilir. Canlı bir konuşmada devam eden sırayı puanlamak için tamamlanmış sıralar ve ardından o anki yarım sıra verilir; son kelimeden sonraki olasılık sıra sonu puanıdır. Puan turnturk_config.json dosyasındaki eşiği (0.127) aştığında sıra sonu tahmin edilir. Sesli asistanlarda puan genellikle ses aktivitesi dedektörü sessizlik bildirdiğinde sorgulanır.
Files / Dosyalar
| File / Dosya | Content / İçerik |
|---|---|
model.safetensors |
Model weights / Model ağırlıkları |
config.json, generation_config.json |
Model configuration / Model yapılandırması |
tokenizer.json, tokenizer_config.json |
Tokenizer with <ts>, <sp1>, <sp2> / <ts>, <sp1>, <sp2> içeren tokenizer |
turnturk_config.json |
Input normalisation, special tokens, context length and recommended threshold / Girdi normalizasyonu, özel token'lar, bağlam uzunluğu ve önerilen eşik |
Related Resources / İlgili Kaynaklar
- Syn-TurnTurk: synthetic Turkish dialogues for turn-taking / sıra alma için sentetik Türkçe diyaloglar
- Real-TurnTurk: multimodal Turkish dyadic conversations / çok kipli Türkçe ikili konuşmalar
Contributors / Katkıda Bulunanlar
License / Lisans
This model is licensed under the MIT License. / Bu model MIT Lisansı ile sunulmaktadır.
- Downloads last month
- -
Model tree for tugrulbayrak/TurnTurk-Gpt
Base model
ytu-ce-cosmos/turkish-gpt2