Image-Text-to-Text
Transformers
Safetensors
English
sapnous_t1
text-generation
multimodal
conversational
custom_code
Instructions to use Sapnous-AI/Sapnous-VR-47B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sapnous-AI/Sapnous-VR-47B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Sapnous-AI/Sapnous-VR-47B", trust_remote_code=True) 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Sapnous-AI/Sapnous-VR-47B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Sapnous-AI/Sapnous-VR-47B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sapnous-AI/Sapnous-VR-47B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sapnous-AI/Sapnous-VR-47B", "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/Sapnous-AI/Sapnous-VR-47B
- SGLang
How to use Sapnous-AI/Sapnous-VR-47B 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 "Sapnous-AI/Sapnous-VR-47B" \ --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": "Sapnous-AI/Sapnous-VR-47B", "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 "Sapnous-AI/Sapnous-VR-47B" \ --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": "Sapnous-AI/Sapnous-VR-47B", "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 Sapnous-AI/Sapnous-VR-47B with Docker Model Runner:
docker model run hf.co/Sapnous-AI/Sapnous-VR-47B
Download model.py from Sapnous-AI/Sapnous-VR-47B: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/Sapnous-AI/Sapnous-VR-47B/resolve/main/model.py
- Command line
-
hf download hf://Sapnous-AI/Sapnous-VR-47B/model.py
-
curl -L -o model.py https://huggingface.co/Sapnous-AI/Sapnous-VR-47B/resolve/main/model.py
1.67 kB
| # coding=utf-8 | |
| # Copyright 2025-present, the HuggingFace Inc. Team and AIRAS Inc. Team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| from transformers import PreTrainedModel, AutoConfig | |
| import torch | |
| import torch.nn as nn | |
| class SapnousT1ForCausalLM(PreTrainedModel): | |
| config_class = AutoConfig | |
| def __init__(self, config): | |
| super().__init__(config) | |
| self.hidden_size = config.hidden_size | |
| self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size) | |
| self.layers = nn.ModuleList([ | |
| nn.Linear(config.hidden_size, config.hidden_size) for _ in range(config.num_hidden_layers) | |
| ]) | |
| self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False) | |
| def forward(self, input_ids): | |
| hidden_states = self.embed_tokens(input_ids) | |
| for layer in self.layers: | |
| hidden_states = layer(hidden_states) | |
| logits = self.lm_head(hidden_states) | |
| return logits | |
| # Register model with transformers | |
| from transformers import AutoModelForCausalLM | |
| AutoModelForCausalLM.register(SapnousT1ForCausalLM, "sapnous_t1") | |