Instructions to use CPSPX/babylm-zho-pinyin-code-33M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CPSPX/babylm-zho-pinyin-code-33M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CPSPX/babylm-zho-pinyin-code-33M", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("CPSPX/babylm-zho-pinyin-code-33M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CPSPX/babylm-zho-pinyin-code-33M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CPSPX/babylm-zho-pinyin-code-33M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CPSPX/babylm-zho-pinyin-code-33M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CPSPX/babylm-zho-pinyin-code-33M
- SGLang
How to use CPSPX/babylm-zho-pinyin-code-33M 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 "CPSPX/babylm-zho-pinyin-code-33M" \ --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": "CPSPX/babylm-zho-pinyin-code-33M", "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 "CPSPX/babylm-zho-pinyin-code-33M" \ --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": "CPSPX/babylm-zho-pinyin-code-33M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CPSPX/babylm-zho-pinyin-code-33M with Docker Model Runner:
docker model run hf.co/CPSPX/babylm-zho-pinyin-code-33M
Configuration Parsing Warning:In UNKNOWN_FILENAME: "auto_map.AutoTokenizer" must be a string
babylm-zho-pinyin-code-33M
A compact GPT-style causal language model for the 2026 Chinese BabyLM Challenge, trained on a pinyin-code representation of Mandarin instead of Hanzi.
Each Mandarin word is segmented with jieba and every syllable is encoded as a compact
initial+digit token that preserves the pinyin initial, a tone group, and a
syllable-length bucket — e.g. 我们 → W6M7. It is a lossy, phonology-first encoding.
- Architecture: 8 layers · 8 heads · 512 hidden · 512 context · 16k SentencePiece-BPE vocab (~33.4M params)
- Training data: BabyLM-zho (~73M pinyin-code tokens), 5 epochs
- Bigger sibling: CPSPX/babylm-zho-pinyin-code-97M
Evaluation — chinese-babylm-eval-pipeline
| Task | Score |
|---|---|
| ZhoBLiMP (acc) | 68.79 |
| Hanzi-structure (acc) | 55.10 |
| Hanzi-pinyin (acc) | 95.35 |
| AFQMC (acc) | 69.00 |
| OCNLI (acc) | 57.63 |
| TNEWS (acc) | 50.73 |
| CLUEWSC (acc) | 62.50 |
| word_fmri (corr) | 0.556 |
| fmri (corr) | 0.089 |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "CPSPX/babylm-zho-pinyin-code-33M"
model = AutoModelForCausalLM.from_pretrained(name, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(name, trust_remote_code=True)
# The tokenizer auto-converts raw Mandarin into the pinyin-code representation:
inputs = tokenizer("我们一起来看电影吧", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(out[0]))
trust_remote_code=True is required — the architecture and the transliterating
tokenizer are custom. Source: https://github.com/tbhrobrecht/babylm-pinyin-abbreviations
- Downloads last month
- 6,198