Text Generation
Transformers
Safetensors
GGUF
Persian
gemma2
mergekit
Merge
conversational
text-generation-inference
Instructions to use mshojaei77/gemma-2-2b-fa-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mshojaei77/gemma-2-2b-fa-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mshojaei77/gemma-2-2b-fa-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mshojaei77/gemma-2-2b-fa-v2") model = AutoModelForCausalLM.from_pretrained("mshojaei77/gemma-2-2b-fa-v2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mshojaei77/gemma-2-2b-fa-v2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mshojaei77/gemma-2-2b-fa-v2:Q8_0 # Run inference directly in the terminal: llama cli -hf mshojaei77/gemma-2-2b-fa-v2:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mshojaei77/gemma-2-2b-fa-v2:Q8_0 # Run inference directly in the terminal: llama cli -hf mshojaei77/gemma-2-2b-fa-v2:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf mshojaei77/gemma-2-2b-fa-v2:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf mshojaei77/gemma-2-2b-fa-v2:Q8_0
Use Docker
docker model run hf.co/mshojaei77/gemma-2-2b-fa-v2:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use mshojaei77/gemma-2-2b-fa-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mshojaei77/gemma-2-2b-fa-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mshojaei77/gemma-2-2b-fa-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mshojaei77/gemma-2-2b-fa-v2:Q8_0
- SGLang
How to use mshojaei77/gemma-2-2b-fa-v2 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 "mshojaei77/gemma-2-2b-fa-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mshojaei77/gemma-2-2b-fa-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mshojaei77/gemma-2-2b-fa-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mshojaei77/gemma-2-2b-fa-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use mshojaei77/gemma-2-2b-fa-v2 with Ollama:
ollama run hf.co/mshojaei77/gemma-2-2b-fa-v2:Q8_0
- Unsloth Desktop
- Docker Model Runner
How to use mshojaei77/gemma-2-2b-fa-v2 with Docker Model Runner:
docker model run hf.co/mshojaei77/gemma-2-2b-fa-v2:Q8_0
- Lemonade
How to use mshojaei77/gemma-2-2b-fa-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mshojaei77/gemma-2-2b-fa-v2:Q8_0
Run and chat with the model
lemonade run user.gemma-2-2b-fa-v2-Q8_0
List all available models
lemonade list
- Atomic Chat
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
---
|
| 2 |
base_model:
|
| 3 |
-
- mshojaei77/gemma-2-2b-fa-v3
|
| 4 |
- mshojaei77/Gemma-2-2b-fa
|
| 5 |
library_name: transformers
|
| 6 |
tags:
|
|
@@ -17,14 +16,13 @@ language:
|
|
| 17 |
|
| 18 |

|
| 19 |
|
| 20 |
-
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 **
|
| 21 |
|
| 22 |
This model builds upon the foundation of Google's Gemma-2-2b-it and the initial fine-tuning efforts of `mshojaei77/Gemma-2b-fa`.
|
| 23 |
|
| 24 |
## Key Improvements in v2
|
| 25 |
|
| 26 |
* **Optimized Performance:** This version incorporates techniques to improve the model's performance in generating Persian text and engaging in conversations.
|
| 27 |
-
* **Selective Self-Distillation:** Experimental self-distillation methods have been applied to refine the model's knowledge and generation quality.
|
| 28 |
* **Self-Merged:** The model has been merged with itself, potentially leading to a more robust and coherent representation.
|
| 29 |
|
| 30 |
**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.**
|
|
@@ -67,7 +65,7 @@ print(assistant_response)
|
|
| 67 |
|
| 68 |
* **Base Model:** google/gemma-2-2b-it
|
| 69 |
* **Previous Version:** mshojaei77/Gemma-2b-fa
|
| 70 |
-
* **Optimization Techniques:**
|
| 71 |
* **Architecture:** Gemma2ForCausalLM (same as base model)
|
| 72 |
* **Model Size:** 2 billion parameters
|
| 73 |
|
|
@@ -75,7 +73,7 @@ print(assistant_response)
|
|
| 75 |
|
| 76 |
This model is intended for:
|
| 77 |
|
| 78 |
-
* **Research and Experimentation:** Exploring the impact of
|
| 79 |
* **Educational Purposes:** Demonstrating advanced fine-tuning and optimization methods.
|
| 80 |
* **Community Development:** Contributing to the growing ecosystem of Persian language models.
|
| 81 |
* **Prototyping (with caution):** For early-stage prototyping, acknowledging its experimental nature.
|
|
@@ -90,3 +88,7 @@ While optimized, this model still has limitations:
|
|
| 90 |
* **Potential for Imperfections:** May still exhibit issues like fluency problems, factual inaccuracies, or biases.
|
| 91 |
|
| 92 |
**Use this model responsibly and be aware of its experimental nature.**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
base_model:
|
|
|
|
| 3 |
- mshojaei77/Gemma-2-2b-fa
|
| 4 |
library_name: transformers
|
| 5 |
tags:
|
|
|
|
| 16 |
|
| 17 |

|
| 18 |
|
| 19 |
+
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.
|
| 20 |
|
| 21 |
This model builds upon the foundation of Google's Gemma-2-2b-it and the initial fine-tuning efforts of `mshojaei77/Gemma-2b-fa`.
|
| 22 |
|
| 23 |
## Key Improvements in v2
|
| 24 |
|
| 25 |
* **Optimized Performance:** This version incorporates techniques to improve the model's performance in generating Persian text and engaging in conversations.
|
|
|
|
| 26 |
* **Self-Merged:** The model has been merged with itself, potentially leading to a more robust and coherent representation.
|
| 27 |
|
| 28 |
**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.**
|
|
|
|
| 65 |
|
| 66 |
* **Base Model:** google/gemma-2-2b-it
|
| 67 |
* **Previous Version:** mshojaei77/Gemma-2b-fa
|
| 68 |
+
* **Optimization Techniques:** Self-Merging, Further Optimization.
|
| 69 |
* **Architecture:** Gemma2ForCausalLM (same as base model)
|
| 70 |
* **Model Size:** 2 billion parameters
|
| 71 |
|
|
|
|
| 73 |
|
| 74 |
This model is intended for:
|
| 75 |
|
| 76 |
+
* **Research and Experimentation:** Exploring the impact of Self-Merging techniques on Persian Gemma models.
|
| 77 |
* **Educational Purposes:** Demonstrating advanced fine-tuning and optimization methods.
|
| 78 |
* **Community Development:** Contributing to the growing ecosystem of Persian language models.
|
| 79 |
* **Prototyping (with caution):** For early-stage prototyping, acknowledging its experimental nature.
|
|
|
|
| 88 |
* **Potential for Imperfections:** May still exhibit issues like fluency problems, factual inaccuracies, or biases.
|
| 89 |
|
| 90 |
**Use this model responsibly and be aware of its experimental nature.**
|
| 91 |
+
|
| 92 |
+
**Citation:**
|
| 93 |
+
|
| 94 |
+
If you use this model in your research or applications, please cite it using the following DOI: [10.57967/hf/4772](https://doi.org/10.57967/hf/4772)
|