Downloads · 30 days
0
nursimakgul/turkce-bpe-tokenizer
turkce-bpe-tokenizer is a machine learning model from nursimakgul. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Bu repo, sifirdan (from-scratch) yazdigim bir byte-level BPE (Byte-Pair Encoding) tokenizer'in ciktisini icerir. Egitim ve kod, Karpathy'nin minbpe reposundaki yaklasimi ve HuggingFace LLM Course Chapter 6.5'teki adim…
Downloads · 30 days
0
Access
Public
Updated Jul 16, 2026
Repo size
3 KB
Likes
0
Public
Click a slice to open those files.
.vocab4.9 KB · 45%
From the Hugging Face model README
Bu repo, sifirdan (from-scratch) yazdigim bir byte-level BPE (Byte-Pair Encoding) tokenizer'in ciktisini icerir. Egitim ve kod, Karpathy'nin minbpe reposundaki yaklasimi ve HuggingFace LLM Course Chapter 6.5'teki adim adim egitim algoritmasini temel aliyor.
benim_bpe_tokenizerim.model - ogrenilen merge kurallaribenim_bpe_tokenizerim.vocab - insan-okunur vocab dokumufrom huggingface_hub import hf_hub_download
model_path = hf_hub_download(repo_id="nursimakgul/turkce-bpe-tokenizer", filename="benim_bpe_tokenizerim.model")
def load_tokenizer(model_path):
merges = {}
vocab = {i: bytes([i]) for i in range(256)}
with open(model_path, "r", encoding="utf-8") as f:
header = f.readline()
assert header.strip() == "bpe v1"
for line in f:
a, b, idx = map(int, line.split())
merges[(a, b)] = idx
vocab[idx] = vocab[a] + vocab[b]
return merges, vocab
merges, vocab = load_tokenizer(model_path)