Instructions to use Zyphra/ZAYA1-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zyphra/ZAYA1-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Zyphra/ZAYA1-base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Zyphra/ZAYA1-base", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Zyphra/ZAYA1-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Zyphra/ZAYA1-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zyphra/ZAYA1-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Zyphra/ZAYA1-base
- SGLang
How to use Zyphra/ZAYA1-base 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 "Zyphra/ZAYA1-base" \ --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": "Zyphra/ZAYA1-base", "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 "Zyphra/ZAYA1-base" \ --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": "Zyphra/ZAYA1-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Zyphra/ZAYA1-base with Docker Model Runner:
docker model run hf.co/Zyphra/ZAYA1-base
Update README.md
#1
by yury-zyphra - opened
README.md
CHANGED
|
@@ -38,12 +38,29 @@ ZAYA1-base performs extremely competitively against other base models of a simil
|
|
| 38 |
|
| 39 |
### Prerequisites
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
### Inference
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
|
|
|
|
|
|
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
### Prerequisites
|
| 40 |
|
| 41 |
+
To use ZAYA1, install `zaya` branch from our fork of `transformers` library, which is based on the v4.57.1 of `transformers`:
|
| 42 |
+
```bash
|
| 43 |
+
pip install "transformers @ git+https://github.com/Zyphra/transformers.git@zaya"
|
| 44 |
+
```
|
| 45 |
|
| 46 |
+
The command above relies on requirements for `transformers v4.57.1` being installed in your environment. If you're installing in a fresh Python environment, you might want to specify a specific extra, like `[dev-torch]`, to install all the dependencies:
|
| 47 |
+
```bash
|
| 48 |
+
pip install "transformers[dev-torch] @ git+https://github.com/Zyphra/transformers.git@zaya"
|
| 49 |
+
```
|
| 50 |
|
| 51 |
|
| 52 |
### Inference
|
| 53 |
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 56 |
+
import torch
|
| 57 |
|
| 58 |
+
tokenizer = AutoTokenizer.from_pretrained("Zyphra/ZAYA1-base")
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained("Zyphra/ZAYA1-base", device_map="cuda", dtype=torch.bfloat16)
|
| 60 |
|
| 61 |
+
input_text = "What factors contributed to the fall of the Roman Empire?"
|
| 62 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
| 63 |
+
|
| 64 |
+
outputs = model.generate(**input_ids, max_new_tokens=100)
|
| 65 |
+
print(tokenizer.decode(outputs[0]))
|
| 66 |
+
```
|