Downloads · 30 days
52
3% of all-time downloads
mshojaei77/gemma-2-2b-fa-v2
gemma-2-2b-fa-v2 is a text generation model from mshojaei77. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
Downloads · 30 days
52
3% of all-time downloads
All-time downloads
1.5K
Public
Parameters
2.6B
13.3 GB on disk
Likes
5
Public
Click a slice to open those files.
.safetensors5.2 GB · 65%
From the Hugging Face model README

This repository hosts Persian Gemma 2b v2, an optimized version of the initial Persian Gemma 2b model. This version has undergone further experimental improvements through techniques like self-merging to enhance its performance and efficiency for Persian language conversational tasks.
This model builds upon the foundation of Google's Gemma-2-2b-it and the initial fine-tuning efforts of mshojaei77/Gemma-2b-fa.
Important Note: This is still an experimental model and is under active development. While optimizations have been applied, it's crucial to understand that it retains the limitations inherent in a 2 billion parameter model and the early-stage nature of this project. Output quality may vary, and critical evaluation is still necessary.
You can use this model just like the original mshojaei77/Gemma-2b-fa, using the transformers library and the pipeline.
import torch
from transformers import pipeline
# Initialize the text generation pipeline
pipe = pipeline(
"text-generation",
model="mshojaei77/gemma-2-2b-fa-v2",
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda", # Or "mps" for Macs with Apple Silicon
)
# Prepare input messages (using the gemma chat template implicitly)
messages = [
{"role": "user", "content": "سلام چطوری؟"},
]
# Generate a response with a maximum of 512 new tokens
outputs = pipe(messages, max_new_tokens=512, chat_template="gemma") # Explicitly using chat_template for clarity
assistant_response = outputs[0]["generated_text"][-1]["content"].strip()
print(assistant_response)
# Example Output (Illustrative - Output quality may vary significantly):
# سلام! من خوبم، ممنون. شما چطوری؟ 😊
Key Usage Notes:
model="mshojaei77/gemma-2-2b-fa-v2": Make sure to specify the correct model name (v2) in your code.chat_template="gemma": Continue to use the gemma chat template for proper formatting.This model is intended for:
While optimized, this model still has limitations:
Use this model responsibly and be aware of its experimental nature.
Citation:
If you use this model in your research or applications, please cite it using the following DOI: 10.57967/hf/4772