MiniCPM-V-4.7-1B-Pashto
Tokenizer-augmented variant of openbmb/MiniCPM-V-4.7-1B in which 18 Pashto-specific characters and Eastern Arabic-Indic digits that the base tokenizer fragmented into multi-token byte sequences are now single atomic tokens.
This is a foundation checkpoint for Pashto/Urdu fine-tuning — not a ready-to-use Pashto model. See the Caveat below before using.
Surgery summary
| Property | Base | This model |
|---|---|---|
len(tokenizer) | 248,094 | 248,112 |
BPE model.vocab | 248,044 | 248,044 (unchanged) |
added_tokens | 50 | 68 (+18) |
config.text_config.vocab_size | 248,094 | 248,112 |
embed_tokens.weight.shape | (248094, 1024) | (248112, 1024) |
lm_head.weight.shape | (248094, 1024) | (248112, 1024) |
tie_word_embeddings | false | false |
New atoms — IDs 248094–248111
| ID | Char | Name | ID | Char | Name |
|---|---|---|---|---|---|
| 248094 | ځ | Pashto dzim | 248103 | ۱ | Eastern Arabic-Indic one |
| 248095 | څ | Pashto tsim | 248104 | ۲ | Eastern Arabic-Indic two |
| 248096 | ږ | Pashto dzhe | 248105 | ۳ | Eastern Arabic-Indic three |
| 248097 | ښ | Pashto xin | 248106 | ۴ | Eastern Arabic-Indic four |
| 248098 | ګ | Pashto gaf | 248107 | ۵ | Eastern Arabic-Indic five |
| 248099 | ڼ | Pashto nun | 248108 | ۶ | Eastern Arabic-Indic six |
| 248100 | ۍ | Pashto yeh | 248109 | ۷ | Eastern Arabic-Indic seven |
| 248101 | ډ | Pashto ddal | 248110 | ۸ | Eastern Arabic-Indic eight |
| 248102 | ۰ | Eastern Arabic-Indic zero | 248111 | ۹ | Eastern Arabic-Indic nine |
Pashto letters already atomic in the base (no change)
Verified present as single tokens before surgery and left untouched: ټ (169490), ړ (154939), ښ variant (169787), and the shared Arabic/Perso-Arabic set ا ب پ ت ث ج چ ح خ د ذ ر ز ژ س ش ص ض ط ظ ع غ ف ق ک گ ل م ن و ه ی.
⚠️ Caveat
The 18 new embedding rows and their lm_head counterparts were initialized with Normal(0, 0.02) and are therefore uncorrelated with the surrounding Arabic-script embedding space.
- ✅ The tokenizer treats these characters as single atomic units.
- ✅
config.json,tokenizer.json,embed_tokens, andlm_headare all internally consistent atvocab_size = 248,112. - ⚠️ The model does not understand the new atoms semantically yet.
Zero-shot Pashto/Urdu generation is not meaningfully better than the base model for words containing the new atoms. This release exists so that fine-tuning starts from a correctly tokenizing foundation rather than a broken one — with the base tokenizer, those 18 characters each cost 2–3 tokens and are therefore underrepresented in any downstream training signal.
Usage
import torch
from transformers import AutoProcessor, AutoModelForImageTextToText
model_id = "nassimjp/MiniCPM-V-4.7-1B-Pashto"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
model.eval()
messages = [
{
"role": "user",
"content": "په پښتو کې دا جمله وژباړه: The weather is nice today.",
},
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=128)
generated = output[0][inputs["input_ids"].shape[1]:]
print(processor.tokenizer.decode(generated, skip_special_tokens=True))
Verify the tokenizer after download
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("nassimjp/MiniCPM-V-4.7-1B-Pashto")
assert len(tok) == 248112
atoms = ["ځ","څ","ږ","ښ","ګ","ڼ","ۍ","ډ",
"۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"]
for a in atoms:
ids = tok.encode(a, add_special_tokens=False)
assert len(ids) == 1, f"{a!r} split into {ids}"
print("✅ all 18 atoms are single tokens; vocab = 248112")
Requirements
transformers >= 5.19.0(forMiniCPMV4_7ForConditionalGeneration)torch >= 2.4- Python 3.10+
Provenance
| Base model | openbmb/MiniCPM-V-4.7-1B |
| Method | tokenizer.add_tokens([...18 atoms...]) + model.resize_token_embeddings(248112) |
| Init | Fresh Normal(0, 0.02) applied independently to embed_tokens[248094:248112] and lm_head[248094:248112] |
| Weights | tie_word_embeddings = false, so input and output rows were drawn independently |
| Precision | bfloat16 |
| Environment | transformers==5.19.0, torch==2.14.1+cu130 |
| Total parameters | 1,554,513,136 |
Intended use
- ✅ Starting checkpoint for LoRA or full fine-tuning on Pashto / Urdu
- ✅ Tokenizer base for corpora that require atomic Pashto characters
- ✅ Research into vocabulary expansion for under-resourced scripts
- ❌ Not zero-shot Pashto generation
- ❌ Not a drop-in replacement for the base model's general capabilities
Suggested fine-tuning approach
Because the random rows are isolated to embed_tokens and lm_head, the cheapest effective recipe targets exactly those:
- Stage 1 (~500 steps) — freeze everything except
embed_tokensandlm_head. LR ≈1e-3. Teaches the 18 new rows to align with the surrounding Arabic-script space. - Stage 2 — unfreeze the last transformer block (layer 23) and continue at LR ≈
1e-4. - Stage 3 (optional) — full LoRA at LR ≈
2e-4on any parallel corpus.
Data suggestions: facebook/flores (pbt_Arab), Helsinki-NLP/opus-100 (en-ps), or any Pashto monolingual text for continued pretraining.
Known limitations
- The 18 new atoms have no semantic grounding until fine-tuned.
- The image pipeline is inherited unchanged from the base model and was not re-validated for Pashto-annotated images.
- No evaluation numbers are provided because no fine-tuning has been performed. Any claims of Pashto capability would be unsupported.
Files
| File | Purpose |
|---|---|
config.json | Model config, text_config.vocab_size = 248112 |
generation_config.json | Generation defaults |
model-00001-of-00002.safetensors | Shard 1 of 2 |
model-00002-of-00002.safetensors | Shard 2 of 2 |
model.safetensors.index.json | Shard index |
tokenizer.json | Tokenizer, 68 added_tokens |
tokenizer_config.json | Tokenizer class metadata |
chat_template.jinja | Chat template (MiniCPM-V-4.7 format) |
preprocessor_config.json | Image preprocessing for MiniCPMV4_6ImageProcessor |
processor_config.json | Processor wrapper placeholder |
pashto_surgery_info.txt | Record of the 18 new token IDs |
Citation
If you use this checkpoint, please cite the base model:
@misc{minicpmv47,
title = {MiniCPM-V-4.7-1B},
author = {OpenBMB},
year = {2026},
url = {https://huggingface.co/openbmb/MiniCPM-V-4.7-1B}
}
License
Inherits the license of the base model. See openbmb/MiniCPM-V-4.7-1B for terms.
---