Run this model with HF Jobs
Run iman1377/Optimized-Persian-LLM on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/iman1377/Optimized-Persian-LLM. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/iman1377/Optimized-Persian-LLM on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/iman1377/Optimized-Persian-LLM. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use iman1377/Optimized-Persian-LLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iman1377/Optimized-Persian-LLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iman1377/Optimized-Persian-LLM") 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("iman1377/Optimized-Persian-LLM") model = AutoModelForCausalLM.from_pretrained("iman1377/Optimized-Persian-LLM", 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 iman1377/Optimized-Persian-LLM 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 iman1377/Optimized-Persian-LLM:Q4_0 # Run inference directly in the terminal: llama cli -hf iman1377/Optimized-Persian-LLM:Q4_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf iman1377/Optimized-Persian-LLM:Q4_0 # Run inference directly in the terminal: llama cli -hf iman1377/Optimized-Persian-LLM:Q4_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 iman1377/Optimized-Persian-LLM:Q4_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf iman1377/Optimized-Persian-LLM:Q4_0
Use Docker
docker model run hf.co/iman1377/Optimized-Persian-LLM:Q4_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use iman1377/Optimized-Persian-LLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iman1377/Optimized-Persian-LLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iman1377/Optimized-Persian-LLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/iman1377/Optimized-Persian-LLM:Q4_0
- SGLang
How to use iman1377/Optimized-Persian-LLM 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 "iman1377/Optimized-Persian-LLM" \ --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": "iman1377/Optimized-Persian-LLM", "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 "iman1377/Optimized-Persian-LLM" \ --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": "iman1377/Optimized-Persian-LLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use iman1377/Optimized-Persian-LLM with Ollama:
ollama run hf.co/iman1377/Optimized-Persian-LLM:Q4_0
- Unsloth Desktop
- Docker Model Runner
How to use iman1377/Optimized-Persian-LLM with Docker Model Runner:
docker model run hf.co/iman1377/Optimized-Persian-LLM:Q4_0
- Lemonade
How to use iman1377/Optimized-Persian-LLM with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull iman1377/Optimized-Persian-LLM:Q4_0
Run and chat with the model
lemonade run user.Optimized-Persian-LLM-Q4_0
List all available models
lemonade list
- Atomic Chat
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("iman1377/Optimized-Persian-LLM")
model = AutoModelForCausalLM.from_pretrained("iman1377/Optimized-Persian-LLM", 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]:]))Optimized-Persian-LLM
مدل فارسی-انگلیسی ۱ میلیاردی برای اجرای سریع روی هر سختافزار
Q4_0 · 687 MiB · 162 tok/s روی یک Tesla T4 · 4/4 تست کیفیت
معرفی
نسخهٔ آمادهٔ اجرای Gemma 3 1B بر پایهٔ چکپوینت QAT گوگل؛ مدلی که از ابتدا برای کوانت ۴ بیتی آموزش دیده تا کیفیت پس از فشردهسازی حفظ شود. یک فایل GGUF، بدون کد سفارشی، قابل اجرا با llama.cpp روی CPU، یک GPU یا چند GPU.
huggingface-cli download iman1377/Optimized-Persian-LLM
gguf/Optimized-Persian-LLM-1B-Q4_0.gguf --local-dir ./opl
llama-cli -m ./opl/gguf/Optimized-Persian-LLM-1B-Q4_0.gguf -ngl 99 -fa on -c 4096 -cnv
بنچمارک
همهٔ اعداد روی Tesla T4 با llama.cpp و -fa on اندازهگیری شدهاند.
| سنجه | مقدار | شرایط |
|---|---|---|
| تولید متن (tg128) | ۱۶۲.۳۷ tok/s | یک T4، تکجریان |
| پردازش پرامپت (pp512) | ۷٬۰۳۵ tok/s | یک T4، تکجریان |
| توان دستهای | ~۲٬۲۰۰ tok/s | یک T4، ۲۵۶ درخواست همزمان |
| توان دستهای | ~۴٬۳۰۰ tok/s | دو T4 مستقل، ۲۵۶ درخواست هر کدام |
| حجم فایل | ۶۸۷ MiB | Q4_0 |
| کیفیت (متن فارسی کنارگذاشتهشده) | perplexity نسبت به F16 |
|---|---|
| این نسخه (QAT Q4_0) | −۱۸.۵۷٪ |
| نسخهٔ قبلی (IQ4_XS، واژگان هرسشده) | +۲۴.۵۱٪ |
تکجریان یعنی سرعتی که یک کاربر حس میکند؛ دستهای یعنی مجموع توان سرور زیر بار همزمان. این دو عدد قابل جایگزینی نیستند.
تست
اسکریپت زیر مدل را دانلود میکند، چهار پروب کیفیت را اجرا میکند و سرعت را روی ماشین شما میسنجد.
import time from llama_cpp import Llama from huggingface_hub import hf_hub_download
path = hf_hub_download("iman1377/Optimized-Persian-LLM", "gguf/Optimized-Persian-LLM-1B-Q4_0.gguf") llm = Llama(model_path=path, n_gpu_layers=-1, n_ctx=2048, verbose=False) # CPU: n_gpu_layers=0
PROBES = [ ("پایتخت ایران کجاست؟ فقط در یک جمله پاسخ بده.", "تهران"), ("پایتخت ایران کجاست؟", "تهران"), ("یک تابع پایتون برای جمع دو عدد بنویس.", "def"), ("سه کاربرد یادگیری ماشین را کوتاه فهرست کن.", None), ]
def persian_ratio(t): L = [c for c in t if c.isalpha()] return sum("\u0600" <= c <= "\u06FF" for c in L) / max(1, len(L))
passed = 0 for q, must in PROBES: a = llm.create_chat_completion(messages=[{"role": "user", "content": q}], temperature=0, max_tokens=200)["choices"][0]["message"]["content"].strip() ok = (must in a) if must else (len(a) > 20 and persian_ratio(a) >= 0.5) passed += ok print(f"[{'PASS' if ok else 'FAIL'}] {q}\n {a[:160]}\n")
t = time.time() r = llm.create_chat_completion(messages=[{"role": "user", "content": "یک پاراگراف درباره تاریخ ایران بنویس."}], temperature=0, max_tokens=256) n = r["usage"]["completion_tokens"] print(f"quality: {passed}/{len(PROBES)} speed: {n/(time.time()-t):.1f} tok/s")
نتیجهٔ مورد انتظار: quality: 4/4. اگر پروبی رد شد، اول مطمئن شوید قالب گفتوگو اعمال شده است.
نسخههای قبلی با revision= در دسترساند: v2-1b-pruned-vocab و v1-2B-engine.
English
Ready-to-run Gemma 3 1B for Persian and English, built on Google's quantization-aware checkpoint. One Q4_0 GGUF file (687 MiB), no custom code, runs with llama.cpp on CPU, one GPU or many.
Benchmarks (Tesla T4, llama.cpp, flash attention):
| Metric | Value | Conditions |
|---|---|---|
| Generation (tg128) | 162.37 tok/s | 1xT4, single stream |
| Prompt processing (pp512) | 7,035 tok/s | 1xT4, single stream |
| Batched throughput | ~2,200 tok/s | 1xT4, 256 concurrent |
| Batched throughput | ~4,300 tok/s | 2xT4 independent, 256 each |
| Quality vs F16 (held-out Persian) | -18.57% perplexity | previous IQ4_XS build: +24.51% |
Test: run the script above. Expected result is quality: 4/4; the speed line is your own hardware.
Derived from google/gemma-3-1b-it-qat-q4_0-unquantized, released under the Gemma licence.
- Downloads last month
- 2,411
Model tree for iman1377/Optimized-Persian-LLM
Base model
google/gemma-3-1b-pt
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iman1377/Optimized-Persian-LLM") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)