Instructions to use Zyphra/ZAYA1-VL-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zyphra/ZAYA1-VL-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Zyphra/ZAYA1-VL-8B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("Zyphra/ZAYA1-VL-8B", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Zyphra/ZAYA1-VL-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Zyphra/ZAYA1-VL-8B" # 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-VL-8B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Zyphra/ZAYA1-VL-8B
- SGLang
How to use Zyphra/ZAYA1-VL-8B 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-VL-8B" \ --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-VL-8B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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-VL-8B" \ --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-VL-8B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Zyphra/ZAYA1-VL-8B with Docker Model Runner:
docker model run hf.co/Zyphra/ZAYA1-VL-8B
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- Zyphra/ZAYA1-base
|
| 5 |
+
pipeline_tag: image-text-to-text
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
# ZAYA1-8B-VL
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
## Performance
|
| 14 |
+
|
| 15 |
+
ZAYA1-8B-VL performs extremely strongly against models of a comparable size and inference flops including outperforming several strong larger models.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
|
| 19 |
+
### Key Capabilities:
|
| 20 |
+
|
| 21 |
+
* **Strong OCR and Document Understanding**: Excels at reading and understanding complex documents
|
| 22 |
+
|
| 23 |
+
* **Powerful Gruonding and Spatial Perception**: Possesses strong grounding and bounding-box capabilities especially for high-resolution images.
|
| 24 |
+
|
| 25 |
+
* **Multimodal Reasoning**: Capable of powerful and detailed mathematical and scientific reasoning about images.
|
| 26 |
+
|
| 27 |
+
* **GUI and Computer-Use**: Highly proficient at reading websites and phone apps, pointing to correct buttons, and general computer use interactions.
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
### Model Architecture
|
| 31 |
+
|
| 32 |
+
ZAYA1-8B-VL builds upon and uses our [ZAYA1-7B LLM](https://huggingface.co/Zyphra/ZAYA1-base) as its base text encoder. We also use the [Qwen2.5-VL vision encoder](https://huggingface.co/docs/transformers/model_doc/qwen2_5_vl) for the ViT. ZAYA1-8B-VL introduces two novel architectural innovations:
|
| 33 |
+
|
| 34 |
+
* **Vision-specific LoRA parameters**: ZAYA1-8B-VL utilizes specialized LoRA parameters on its MLPs and CCA weights which are only activated on vision tokens. We find that adding vision-specific parameters substantially improves model performance since the model has the option to devote specific parameters solely to visual processing. We train these LoRA parameters alongside the main model parameters during training.
|
| 35 |
+
|
| 36 |
+
* **Bidirectional Attention for image tokens**: ZAYA1-8B-VL processes all image token inputs with a bidirectional attention mask, meaning attention is not causal across an image. We find that this improves performance by not imposing an arbitrary causal order to image tokens which are naturally non-causal.
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
|
| 41 |
+
ZAYA1-8B-VL is trained only upon open data. Detailed dataset descriptions can be found in the accompanying technical report.
|
| 42 |
+
|
| 43 |
+
## Quick start
|
| 44 |
+
|
| 45 |
+
### Prerequisites
|
| 46 |
+
|
| 47 |
+
TODO
|
| 48 |
+
|
| 49 |
+
To use ZAYA1, install `zaya` branch from our fork of `transformers` library, which is based on the v4.57.1 of `transformers`:
|
| 50 |
+
```bash
|
| 51 |
+
pip install "transformers @ git+https://github.com/Zyphra/transformers.git@zaya"
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
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:
|
| 55 |
+
```bash
|
| 56 |
+
pip install "transformers[dev-torch] @ git+https://github.com/Zyphra/transformers.git@zaya"
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
### Inference
|
| 61 |
+
|
| 62 |
+
TODO
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 66 |
+
import torch
|
| 67 |
+
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained("Zyphra/ZAYA1-base")
|
| 69 |
+
model = AutoModelForCausalLM.from_pretrained("Zyphra/ZAYA1-base", device_map="cuda", dtype=torch.bfloat16)
|
| 70 |
+
|
| 71 |
+
input_text = "What factors contributed to the fall of the Roman Empire?"
|
| 72 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
| 73 |
+
|
| 74 |
+
outputs = model.generate(**input_ids, max_new_tokens=100)
|
| 75 |
+
print(tokenizer.decode(outputs[0]))
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
### Citation
|
| 79 |
+
|
| 80 |
+
If you find our work helpful, feel free to give us a cite.
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
TODO
|
| 84 |
+
```
|