Text Generation
Transformers
Safetensors
zagros
nlp
translation
sentiment-analysis
question-answering
persian
mixture-of-experts
Mixture of Experts
conversational
Instructions to use darsadilab/zagros-1.0-quick with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use darsadilab/zagros-1.0-quick with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="darsadilab/zagros-1.0-quick") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("darsadilab/zagros-1.0-quick", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use darsadilab/zagros-1.0-quick with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "darsadilab/zagros-1.0-quick" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "darsadilab/zagros-1.0-quick", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/darsadilab/zagros-1.0-quick
- SGLang
How to use darsadilab/zagros-1.0-quick 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 "darsadilab/zagros-1.0-quick" \ --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": "darsadilab/zagros-1.0-quick", "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 "darsadilab/zagros-1.0-quick" \ --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": "darsadilab/zagros-1.0-quick", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use darsadilab/zagros-1.0-quick with Docker Model Runner:
docker model run hf.co/darsadilab/zagros-1.0-quick
Update README.md
Browse files
README.md
CHANGED
|
@@ -115,13 +115,37 @@ pip install git+https://github.com/ZagrosLLMModel/transformers.git@main
|
|
| 115 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 116 |
|
| 117 |
model_name = "darsadilab/zagros-1.0-quick"
|
| 118 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 119 |
-
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
```
|
| 126 |
|
| 127 |
### Deployment
|
|
|
|
| 115 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 116 |
|
| 117 |
model_name = "darsadilab/zagros-1.0-quick"
|
|
|
|
|
|
|
| 118 |
|
| 119 |
+
# load the tokenizer and the model
|
| 120 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 121 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 122 |
+
model_name,
|
| 123 |
+
torch_dtype="auto",
|
| 124 |
+
device_map="auto"
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
# prepare the model input
|
| 128 |
+
prompt = "یک وبسایت حرفه ای با استفاده از html طراحی کن که تک کد باشد و شامل css/js داخل همین html باشد."
|
| 129 |
+
messages = [
|
| 130 |
+
{"role": "user", "content": prompt}
|
| 131 |
+
]
|
| 132 |
+
text = tokenizer.apply_chat_template(
|
| 133 |
+
messages,
|
| 134 |
+
tokenize=False,
|
| 135 |
+
add_generation_prompt=True,
|
| 136 |
+
)
|
| 137 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 138 |
+
|
| 139 |
+
# conduct text completion
|
| 140 |
+
generated_ids = model.generate(
|
| 141 |
+
**model_inputs,
|
| 142 |
+
max_new_tokens=16384
|
| 143 |
+
)
|
| 144 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 145 |
+
|
| 146 |
+
content = tokenizer.decode(output_ids, skip_special_tokens=True)
|
| 147 |
+
|
| 148 |
+
print("content:", content)
|
| 149 |
```
|
| 150 |
|
| 151 |
### Deployment
|