salyamq/kk-corpus-v1
Viewer • Updated • 8.66M • 14
How to use salyamq/smq-tokenizer-kz with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("salyamq/smq-tokenizer-kz", device_map="auto")github repo: https://github.com/salyamq/smq_kk_tokenizer
SentencePiece BPE tokenizer trained for the Kazakh language.
smq_kk_tokenizer.model - SentencePiece model filesmq_kk_tokenizer.vocab - vocabulary filefrom huggingface_hub import hf_hub_download
import sentencepiece as spm
model_path = hf_hub_download(
repo_id="salyamq/smq-tokenizer-kz",
filename="smq_kk_tokenizer.model"
)
sp = spm.SentencePieceProcessor()
sp.load(model_path)
tokens = sp.encode("Бұл сөйлем қазақ тілінде жазылған", out_type=str)
print(tokens)
Measured on a held-out Kazakh text chunk (~443K chars):
| Metric | Value |
|---|---|
| Chars/token | 5.37 |
| Bytes/token | 9.93 |
| Tokens/word | 1.49 |
| UNK rate | 0.00% |
Trained with byte_fallback True using the spm.SentencePieceTrainer.train pipeline. Not yet compatible with AutoTokenizer.from_pretrained — load via sentencepiece directly (see usage above).