Downloads · 30 days
11
11% of all-time downloads
nassimjp/Ghanam-7B-Base-Pashto-v0.1
Ghanam-7B-Base-Pashto-v0.1 is a text generation model from nassimjp. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Ghanam-7B-Base-Pashto-v0.1 is an experimental base model that extends the Mistral-7B-v0.1 vocabulary to include 47 Pashto/Arabic characters. This is the first stage of creating a Pashto-capable language model, where t…
Downloads · 30 days
11
11% of all-time downloads
All-time downloads
98
Public
Parameters
7.2B
14.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14.5 GB · 100%
From the Hugging Face model README
Ghanam-7B-Base-Pashto-v0.1 is an experimental base model that extends the Mistral-7B-v0.1 vocabulary to include 47 Pashto/Arabic characters. This is the first stage of creating a Pashto-capable language model, where the tokenizer has been modified and the embedding layer has been expanded to support Pashto script.
ا ب پ ت ث ج چ ح خ د ذ ر ز ژ س ش ص ض ط ظ ع غ ف ق ک ګ گ ل م ن ڼ و ه ی ډ ړ ځ څ ښ ږ ۍ ې ء آ أ ؤ ئ
This model does not yet understand Pashto language semantics. It can:
The model still generates English text as it hasn't been fine-tuned on Pashto data.
This model is the first step in creating a Pashto language model based on Mistral-7B. The vocabulary was expanded using the Stanford vocabulary expansion method (mean resizing), where new embeddings were initialized using the mean of existing embeddings to minimize disruption to the model's performance.
You can use this model for:
This model is intended to be fine-tuned on Pashto text data for:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
# Model path (local or from Hub)
model_path = "nassimjp/Ghanam-7B-Base-Pashto-v0.1"
# 4-bit quantization config
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_path,
quantization_config=bnb_config,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_path)
# Set padding token (optional)
tokenizer.pad_token = tokenizer.eos_token
# Test tokenization
pashto_text = "پښتونخوا کې ډېر ښکلي ښارونه او ځنګلونه شته"
tokens = tokenizer.encode(pashto_text)
print(f"Tokens: {tokens}")
print(f"Decoded: {tokenizer.decode(tokens)}")
# Prompt in Pashto (model will respond in English)
prompt = "سلام، څنګه یاست؟"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=50,
temperature=0.7,
do_sample=True,
repetition_penalty=1.2
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
# Check if Pashto characters are recognized
pashto_chars = ["ښ", "ږ", "څ", "ډ", "ړ", "ځ", "ګ"]
for char in pashto_chars:
token_id = tokenizer.encode(char)[0]
token_str = tokenizer.decode([token_id])
print(f"Character: {char} -> Token ID: {token_id} -> Decoded: {token_str}")
No training data was used for this model. The vocabulary was expanded without any fine-tuning on Pashto text. The model retains only the original Mistral-7B pre-training knowledge.
The model underwent a two-stage process:
Stage 1: Tokenizer Modification
Stage 2: Embedding Resizing
lm_head and embedding layers were resizedInitial testing was performed using:
| Test | Result | Status |
|---|---|---|
| Pashto Tokenization | ✅ All 47 characters recognized | PASS |
| English Generation | ✅ Original performance preserved | PASS |
| Pashto Understanding | ❌ No semantic understanding | EXPECTED |
| Pashto Response | ❌ Generates English | EXPECTED |
| Model Loading (4-bit) | ✅ Successfully loads | PASS |
| Memory Efficiency | ✅ ~4GB VRAM | PASS |
Carbon emissions were minimal as this model:
Did not require any training
Only performed vocabulary expansion and quantization
Used a single GPU for a few minutes
Hardware Type: NVIDIA A100 (or similar)
Hours used: < 1 hour
Cloud Provider: N/A (local)
Compute Region: N/A
Carbon Emitted: Negligible
For questions or collaboration:
To make this model truly Pashto-capable, the next steps include:
If you use this model or the vocabulary expansion method, please cite:
@misc{ghanam2024pashto,
author = {Nassim JP},
title = {Ghanam-7B-Base-Pashto: Vocabulary Expansion for Pashto Language},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/nassimjp/Ghanam-7B-Base-Pashto-v0.1}}
}
@article{jiang2023mistral,
title={Mistral 7B},
author={Jiang, Albert Q and others},
journal={arXiv preprint arXiv:2310.06825},
year={2023}
}
do_sample=True and temperature=0.7 for diverse outputspad_token=tokenizer.eos_token| Issue | Solution |
|---|---|
| Tokenizer missing characters | Ensure you're using the correct tokenizer from this repo |
| Memory errors | Reduce max_new_tokens or use CPU offloading |
| Poor generation quality | This is expected - the model needs fine-tuning |
Pashto text displayed as [UNK] | Tokenizer hasn't loaded properly - reload from the repo |
Model Status: 🔬 Research Phase - Pre-fine-tuning checkpoint
Last Updated: June 2026