Image-Text-to-Text
Transformers
Safetensors
PyTorch
qwen3_5
multimodal
vision-language
vision
image-to-text
llm
vision-language-model
computer-vision
deep-learning
vlm
2b
efficient
production
conversational
Instructions to use raxcore-dev/Rax-4.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use raxcore-dev/Rax-4.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="raxcore-dev/Rax-4.5") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("raxcore-dev/Rax-4.5") model = AutoModelForMultimodalLM.from_pretrained("raxcore-dev/Rax-4.5") 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?"} ] }, ] inputs = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use raxcore-dev/Rax-4.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "raxcore-dev/Rax-4.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "raxcore-dev/Rax-4.5", "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/raxcore-dev/Rax-4.5
- SGLang
How to use raxcore-dev/Rax-4.5 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 "raxcore-dev/Rax-4.5" \ --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": "raxcore-dev/Rax-4.5", "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 "raxcore-dev/Rax-4.5" \ --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": "raxcore-dev/Rax-4.5", "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 raxcore-dev/Rax-4.5 with Docker Model Runner:
docker model run hf.co/raxcore-dev/Rax-4.5
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -5,105 +5,187 @@ pipeline_tag: image-text-to-text
|
|
| 5 |
tags:
|
| 6 |
- multimodal
|
| 7 |
- vision-language
|
| 8 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
# Rax
|
| 12 |
|
| 13 |
-
Rax
|
| 14 |
|
| 15 |
-
##
|
| 16 |
|
| 17 |
-
- **
|
| 18 |
-
- **
|
| 19 |
-
- **
|
| 20 |
-
- **
|
| 21 |
-
- **
|
| 22 |
-
- **Text Hidden Size**: 2048
|
| 23 |
-
- **Precision**: BFloat16
|
| 24 |
|
| 25 |
-
##
|
| 26 |
|
| 27 |
-
|
| 28 |
-
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
from transformers import AutoModelForVision2Seq, AutoProcessor
|
| 38 |
from PIL import Image
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
# Text
|
| 44 |
-
messages = [{"role": "user", "content": "
|
| 45 |
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 46 |
inputs = processor(text=text, return_tensors="pt")
|
| 47 |
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 48 |
print(processor.decode(outputs[0], skip_special_tokens=True))
|
| 49 |
|
| 50 |
-
#
|
| 51 |
-
image = Image.open("
|
| 52 |
-
messages = [{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 54 |
inputs = processor(text=text, images=image, return_tensors="pt")
|
| 55 |
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 56 |
print(processor.decode(outputs[0], skip_special_tokens=True))
|
| 57 |
-
```
|
| 58 |
|
| 59 |
-
###
|
| 60 |
|
| 61 |
-
```bash
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 64 |
|
| 65 |
-
```python
|
| 66 |
from openai import OpenAI
|
|
|
|
| 67 |
client = OpenAI(base_url="http://localhost:8000/v1", api_key="token")
|
| 68 |
|
| 69 |
response = client.chat.completions.create(
|
| 70 |
-
model="raxcore/
|
| 71 |
-
messages=[
|
|
|
|
|
|
|
|
|
|
| 72 |
temperature=0.7,
|
| 73 |
-
max_tokens=
|
| 74 |
)
|
|
|
|
| 75 |
print(response.choices[0].message.content)
|
| 76 |
-
```
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
-
- **Vision Encoder**: 24-layer transformer with patch size 16 and spatial merge 2x2
|
| 82 |
-
- **Efficient KV Cache**: 2 key-value heads for reduced memory footprint
|
| 83 |
-
- **Multi-resolution Position Embeddings**: Optimized for long-context understanding
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
|
| 88 |
-
- For long context (>32K tokens), ensure sufficient GPU memory
|
| 89 |
-
- Enable trust_remote_code when loading the model
|
| 90 |
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
-
- Vision understanding optimized for natural images
|
| 95 |
-
- Long context requires significant memory resources
|
| 96 |
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
| 106 |
author={Raxcore},
|
| 107 |
-
year={2026}
|
|
|
|
| 108 |
}
|
| 109 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
tags:
|
| 6 |
- multimodal
|
| 7 |
- vision-language
|
| 8 |
+
- vision
|
| 9 |
+
- image-to-text
|
| 10 |
+
- llm
|
| 11 |
+
- vision-language-model
|
| 12 |
+
- computer-vision
|
| 13 |
+
- deep-learning
|
| 14 |
+
- pytorch
|
| 15 |
+
- transformers
|
| 16 |
+
- vlm
|
| 17 |
+
- 2b
|
| 18 |
+
- efficient
|
| 19 |
+
- production
|
| 20 |
+
inference: true
|
| 21 |
---
|
| 22 |
|
| 23 |
+
# Rax 4.5 - Efficient 2B Vision Language Model | Multimodal AI
|
| 24 |
|
| 25 |
+
**Rax 4.5** is a state-of-the-art 2 billion parameter multimodal vision-language model optimized for production use. Process images and text together with up to 262K token context length.
|
| 26 |
|
| 27 |
+
## π Why Rax 4.5?
|
| 28 |
|
| 29 |
+
- **β‘ Fast & Efficient**: Only 2B parameters for quick inference
|
| 30 |
+
- **πΌοΈ Vision + Text**: True multimodal understanding of images and language
|
| 31 |
+
- **π Long Context**: 262,144 token context window for complex tasks
|
| 32 |
+
- **π§ Production Ready**: Works with vLLM, SGLang, Transformers out of the box
|
| 33 |
+
- **πΎ Memory Efficient**: Hybrid attention architecture reduces VRAM usage
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
## Model Specifications
|
| 36 |
|
| 37 |
+
| Feature | Details |
|
| 38 |
+
|---------|---------|
|
| 39 |
+
| **Parameters** | ~2 Billion |
|
| 40 |
+
| **Context Length** | 262,144 tokens |
|
| 41 |
+
| **Input Types** | Text + Images |
|
| 42 |
+
| **Architecture** | Hybrid Linear + Full Attention (24 layers) |
|
| 43 |
+
| **Vision Encoder** | 24-layer ViT, 1024 hidden size |
|
| 44 |
+
| **Text Hidden Size** | 2048 |
|
| 45 |
+
| **Precision** | BFloat16 |
|
| 46 |
+
| **License** | Apache 2.0 |
|
| 47 |
|
| 48 |
+
## π₯ Key Capabilities
|
| 49 |
|
| 50 |
+
β
**Image Understanding** - Analyze, describe, and answer questions about images
|
| 51 |
+
β
**Visual Question Answering** - Extract information from screenshots, documents, charts
|
| 52 |
+
β
**Multimodal Reasoning** - Combine visual and textual information for complex tasks
|
| 53 |
+
β
**Long Context Processing** - Handle extensive documents with visual elements
|
| 54 |
+
β
**Production Deployment** - Optimized for real-world applications
|
| 55 |
|
| 56 |
+
## Quick Start
|
| 57 |
+
|
| 58 |
+
### Installation
|
| 59 |
+
|
| 60 |
+
\`\`\`bash
|
| 61 |
+
pip install transformers pillow torch accelerate
|
| 62 |
+
\`\`\`
|
| 63 |
+
|
| 64 |
+
### Basic Usage with Transformers
|
| 65 |
+
|
| 66 |
+
\`\`\`python
|
| 67 |
from transformers import AutoModelForVision2Seq, AutoProcessor
|
| 68 |
from PIL import Image
|
| 69 |
|
| 70 |
+
# Load model
|
| 71 |
+
model = AutoModelForVision2Seq.from_pretrained(
|
| 72 |
+
"raxcore-dev/rax-3.5-chat",
|
| 73 |
+
trust_remote_code=True
|
| 74 |
+
)
|
| 75 |
+
processor = AutoProcessor.from_pretrained(
|
| 76 |
+
"raxcore-dev/rax-3.5-chat",
|
| 77 |
+
trust_remote_code=True
|
| 78 |
+
)
|
| 79 |
|
| 80 |
+
# Text generation
|
| 81 |
+
messages = [{"role": "user", "content": "Explain quantum computing"}]
|
| 82 |
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 83 |
inputs = processor(text=text, return_tensors="pt")
|
| 84 |
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 85 |
print(processor.decode(outputs[0], skip_special_tokens=True))
|
| 86 |
|
| 87 |
+
# Image analysis
|
| 88 |
+
image = Image.open("photo.jpg")
|
| 89 |
+
messages = [{
|
| 90 |
+
"role": "user",
|
| 91 |
+
"content": [
|
| 92 |
+
{"type": "image"},
|
| 93 |
+
{"type": "text", "text": "What's in this image? Be detailed."}
|
| 94 |
+
]
|
| 95 |
+
}]
|
| 96 |
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 97 |
inputs = processor(text=text, images=image, return_tensors="pt")
|
| 98 |
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 99 |
print(processor.decode(outputs[0], skip_special_tokens=True))
|
| 100 |
+
\`\`\`
|
| 101 |
|
| 102 |
+
### Deploy with vLLM (High Performance)
|
| 103 |
|
| 104 |
+
\`\`\`bash
|
| 105 |
+
# Start vLLM server
|
| 106 |
+
vllm serve raxcore-dev/rax-3.5-chat --port 8000 --max-model-len 8192
|
| 107 |
+
\`\`\`
|
| 108 |
|
| 109 |
+
\`\`\`python
|
| 110 |
from openai import OpenAI
|
| 111 |
+
|
| 112 |
client = OpenAI(base_url="http://localhost:8000/v1", api_key="token")
|
| 113 |
|
| 114 |
response = client.chat.completions.create(
|
| 115 |
+
model="raxcore-dev/rax-3.5-chat",
|
| 116 |
+
messages=[
|
| 117 |
+
{"role": "system", "content": "You are a helpful AI assistant."},
|
| 118 |
+
{"role": "user", "content": "Write a Python function to sort a list."}
|
| 119 |
+
],
|
| 120 |
temperature=0.7,
|
| 121 |
+
max_tokens=1024
|
| 122 |
)
|
| 123 |
+
|
| 124 |
print(response.choices[0].message.content)
|
| 125 |
+
\`\`\`
|
| 126 |
+
|
| 127 |
+
## ποΈ Architecture Details
|
| 128 |
|
| 129 |
+
- **Hybrid Attention Mechanism**: Alternates between linear and full attention for efficiency
|
| 130 |
+
- **Vision Transformer**: 24-layer encoder with 16x16 patch size, 2x2 spatial merging
|
| 131 |
+
- **Optimized KV Cache**: 2 key-value heads for 75% memory reduction
|
| 132 |
+
- **Multi-Resolution Position Embeddings**: Handles various image sizes and long sequences
|
| 133 |
+
- **Cross-Modal Fusion**: Advanced alignment between vision and language representations
|
| 134 |
|
| 135 |
+
## π Use Cases
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
- **Document Analysis**: Extract data from invoices, receipts, forms
|
| 138 |
+
- **Visual QA Systems**: Build AI that answers questions about images
|
| 139 |
+
- **Content Moderation**: Analyze images with contextual understanding
|
| 140 |
+
- **Educational Tools**: Explain diagrams, charts, and scientific images
|
| 141 |
+
- **Accessibility**: Generate detailed image descriptions for visually impaired users
|
| 142 |
+
- **E-commerce**: Product analysis and description generation
|
| 143 |
+
- **Medical Imaging**: Assist with image interpretation (not diagnostic)
|
| 144 |
|
| 145 |
+
## βοΈ Performance Tips
|
|
|
|
|
|
|
| 146 |
|
| 147 |
+
- **Temperature**: Use 0.6-0.8 for factual tasks, 0.8-1.0 for creative content
|
| 148 |
+
- **Context Window**: For >32K tokens, ensure 24GB+ VRAM
|
| 149 |
+
- **Batch Processing**: Process multiple images/texts together for efficiency
|
| 150 |
+
- **Quantization**: Use 4-bit/8-bit quantization for lower memory footprint
|
| 151 |
+
- **GPU Requirements**: Minimum 12GB VRAM (16GB recommended)
|
| 152 |
|
| 153 |
+
## π¨ Limitations
|
|
|
|
|
|
|
| 154 |
|
| 155 |
+
- 2B parameters may struggle with highly complex reasoning vs larger models
|
| 156 |
+
- Vision encoder optimized for natural images (not specialized medical/satellite imagery)
|
| 157 |
+
- Long context (>100K tokens) requires significant GPU memory
|
| 158 |
+
- Not fine-tuned for specific domains without additional training
|
| 159 |
|
| 160 |
+
## π€ Model Comparison
|
| 161 |
|
| 162 |
+
| Model | Params | Context | Multimodal | Speed |
|
| 163 |
+
|-------|--------|---------|------------|-------|
|
| 164 |
+
| **Rax 4.5** | 2B | 262K | β
| β‘β‘β‘ |
|
| 165 |
+
| LLaVA 1.5 | 7B | 4K | β
| β‘β‘ |
|
| 166 |
+
| GPT-4V | - | 128K | β
| β‘ |
|
| 167 |
+
| Qwen-VL | 7B | 32K | β
| β‘β‘ |
|
| 168 |
|
| 169 |
+
## π Citation
|
| 170 |
+
|
| 171 |
+
\`\`\`bibtex
|
| 172 |
+
@misc{rax4.5,
|
| 173 |
+
title={Rax 4.5: Efficient Multimodal Vision-Language Model},
|
| 174 |
author={Raxcore},
|
| 175 |
+
year={2026},
|
| 176 |
+
url={https://huggingface.co/raxcore-dev/rax-3.5-chat}
|
| 177 |
}
|
| 178 |
+
\`\`\`
|
| 179 |
+
|
| 180 |
+
## π License
|
| 181 |
+
|
| 182 |
+
Apache 2.0 - Free for commercial and research use
|
| 183 |
+
|
| 184 |
+
## π Links
|
| 185 |
+
|
| 186 |
+
- [Model Card](https://huggingface.co/raxcore-dev/rax-3.5-chat)
|
| 187 |
+
- [Raxcore GitHub](https://github.com/raxcore-dev)
|
| 188 |
+
|
| 189 |
+
---
|
| 190 |
+
|
| 191 |
+
**Keywords**: vision language model, multimodal AI, image to text, VLM, computer vision, transformers, efficient LLM, 2B parameters, long context, production AI, visual question answering, image understanding, open source AI model
|