Text Generation
Transformers
Safetensors
Persian
English
mistral
conversational
text-generation-inference
Instructions to use ZharfaTech/ZharfaOpen-0309 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ZharfaTech/ZharfaOpen-0309 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ZharfaTech/ZharfaOpen-0309") 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("ZharfaTech/ZharfaOpen-0309") model = AutoModelForCausalLM.from_pretrained("ZharfaTech/ZharfaOpen-0309", 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
- vLLM
How to use ZharfaTech/ZharfaOpen-0309 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ZharfaTech/ZharfaOpen-0309" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZharfaTech/ZharfaOpen-0309", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ZharfaTech/ZharfaOpen-0309
- SGLang
How to use ZharfaTech/ZharfaOpen-0309 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 "ZharfaTech/ZharfaOpen-0309" \ --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": "ZharfaTech/ZharfaOpen-0309", "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 "ZharfaTech/ZharfaOpen-0309" \ --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": "ZharfaTech/ZharfaOpen-0309", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ZharfaTech/ZharfaOpen-0309 with Docker Model Runner:
docker model run hf.co/ZharfaTech/ZharfaOpen-0309
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- ZharfaTech/ZharfaTech-OpenAssistant-Guanaco-Persian-Farsi
|
| 5 |
+
- ZharfaTech/ZharfaTech-Open-Platypus-Persian-Farsi
|
| 6 |
+
language:
|
| 7 |
+
- fa
|
| 8 |
+
- en
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
---
|
| 11 |
+
# ZharfaOpen: A State-of-the-Art Persian Language LLM
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
## Model Description
|
| 16 |
+
ZharfaOpen is an open-source large language model fine-tuned from the Mistral-7B architecture. Tailored specifically for the Persian language, ZharfaOpen excels in understanding and generating responses for conversations and instruction-following tasks. As the current state-of-the-art (SOTA) in Persian open-source LLMs, ZharfaOpen represents an advancement in natural language processing capabilities for Persian language speakers and developers.
|
| 17 |
+
|
| 18 |
+
## Example Outputs
|
| 19 |
+
Below are example outputs demonstrating ZharfaOpen's capabilities in conversation and instruction following:
|
| 20 |
+
|
| 21 |
+
**Example 1: Conversation**
|
| 22 |
+
- Input: "سلام، حال شما چطور است؟"
|
| 23 |
+
- Output: "سلام! من یک مدل زبانی هستم و حال من خوب است. چطور میتوانم به شما کمک کنم؟"
|
| 24 |
+
|
| 25 |
+
**Example 2: Instruction Following**
|
| 26 |
+
- Input: "لطفا توضیح دهید چگونه یک ایمیل حرفهای بنویسیم."
|
| 27 |
+
- Output: "برای نوشتن یک ایمیل حرفهای، ابتدا باید با احترام و با استفاده از عنوان رسمی فرد مورد نظر خطاب قرار دهید، سپس موضوع ایمیل را به طور واضح و مختصر بیان کنید..."
|
| 28 |
+
|
| 29 |
+
## Benchmark Results
|
| 30 |
+
To be included
|
| 31 |
+
|
| 32 |
+
## Prompt Format
|
| 33 |
+
ZharfaOpen supports the ChatML format for prompting, enabling users to structure their prompts effectively for conversation and instruction-following tasks. Here's an example prompt format:
|
| 34 |
+
|
| 35 |
+
```xml
|
| 36 |
+
<|im_start|>system
|
| 37 |
+
تو یک مدل زبانی بزرگ هستی به اسم «ژرفا» که به سوالات کاربر به درستی، و با دقت پاسخ میدهی
|
| 38 |
+
<|im_end|>
|
| 39 |
+
<|im_start|>user
|
| 40 |
+
لطفا توضیح دهید چگونه یک ایمیل حرفهای بنویسیم.
|
| 41 |
+
<|im_end|>
|
| 42 |
+
<|im_start|>assistant
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Inference Code
|
| 46 |
+
Here is a simple Python example for using ZharfaOpen with Hugging Face Transformers:
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 50 |
+
|
| 51 |
+
model_name = "ZharfaTech/ZharfaOpen"
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 53 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 54 |
+
|
| 55 |
+
inputs = tokenizer.encode("YOUR_PROMPT_HERE", return_tensors="pt")
|
| 56 |
+
outputs = model.generate(inputs, max_length=50)
|
| 57 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Replace `"YOUR_PROMPT_HERE"` with your input in Persian.
|
| 61 |
+
|
| 62 |
+
## Bias, Risks, and Limitations
|
| 63 |
+
While ZharfaOpen is a significant step forward in Persian LLM technology, users should be aware of potential biases and limitations inherent in any language model. ZharfaOpen has been trained on diverse datasets, but it may still reflect or amplify societal biases present in the training data. Users are encouraged to critically evaluate outputs and consider these factors in their applications.
|
| 64 |
+
|
| 65 |
+
## How to Cite
|
| 66 |
+
If you use ZharfaOpen in your research or application, please cite it as follows:
|
| 67 |
+
|
| 68 |
+
```bibtex
|
| 69 |
+
@misc{zharfaopen2024,
|
| 70 |
+
title={ZharfaOpen: A State-of-the-Art Persian Language LLM},
|
| 71 |
+
author={ZharfaTech Team},
|
| 72 |
+
year={2024},
|
| 73 |
+
note={Model fine-tuned over Mistral-7B for Persian language tasks}
|
| 74 |
+
}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
ZharfaOpen is part of ZharfaTech's commitment to advancing language technologies for the Persian-speaking world. We encourage the community to engage with us in improving and expanding the capabilities of ZharfaOpen.
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
For more information or to contribute to the project, please visit our [GitHub repository](#) or contact us directly. (Insert actual links and contact information)
|