Downloads · 30 days
111
18% of all-time downloads
PersianML/gemma-3-4b-persian
gemma-3-4b-persian is a text generation model from PersianML. 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.
mshojaei77/gemma-3-4b-persian-v0 is a Persian-specialized model built on the Gemma 3 architecture. It leverages QLoRA for 4-bit quantization to reduce computational overhead while generating and understanding Persian…
Downloads · 30 days
111
18% of all-time downloads
All-time downloads
621
Public
Parameters
4.3B
29.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors17.3 GB · 59%
From the Hugging Face model README
mshojaei77/gemma-3-4b-persian-v0 is a Persian-specialized model built on the Gemma 3 architecture. It leverages QLoRA for 4-bit quantization to reduce computational overhead while generating and understanding Persian text. In addition to text generation, the model also retains image input capabilities inherited from its base model.
This model is compatible with both the Hugging Face Transformers library and Ollama.
ollama run mshojaei77/gemma3persian
Install Dependencies:
pip install git+https://github.com/huggingface/[email protected] accelerate
Load Model and Tokenizer:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "mshojaei77/gemma-3-4b-persian-v0"
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto", # Use "cuda" for GPU usage if available
torch_dtype=torch.bfloat16, # Alternatively, use torch.float16
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{
"role": "user",
"content": "توماس جفرسون کیست؟"
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True, tokenize=True, return_tensors="pt"
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This model was fine-tuned using the mshojaei77/Persian_sft dataset, which contains approximately 681,000 rows of Persian text focused on instruction-following and conversational interactions. The dataset features:
peft for QLoRA and bitsandbytes for quantization[SOON]
This model is under active maintenance. Future updates may include:
For any queries, contributions, or issues, please contact me.