Image-Text-to-Text
Transformers
Safetensors
English
sapnous_t1
text-generation
multimodal
conversational
custom_code
Instructions to use Sapnous-AI/Sapnous-VR-12B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sapnous-AI/Sapnous-VR-12B 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-12B", 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-12B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Sapnous-AI/Sapnous-VR-12B 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-12B" # 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-12B", "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-12B
- SGLang
How to use Sapnous-AI/Sapnous-VR-12B 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-12B" \ --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-12B", "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-12B" \ --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-12B", "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-12B with Docker Model Runner:
docker model run hf.co/Sapnous-AI/Sapnous-VR-12B
Download setup.py from Sapnous-AI/Sapnous-VR-12B: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/Sapnous-AI/Sapnous-VR-12B/resolve/main/setup.py
- Command line
-
hf download hf://Sapnous-AI/Sapnous-VR-12B/setup.py
-
curl -L -o setup.py https://huggingface.co/Sapnous-AI/Sapnous-VR-12B/resolve/main/setup.py
545 Bytes
| import sys | |
| import os | |
| # Add the current directory to sys.path so Python can find `configuration_sapnous.py` | |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
| from transformers import AutoModel, AutoConfig | |
| from configuration_sapnous import SapnousT1Config # Now it should work | |
| model_path = r"E:\git\Sapnous-47B\Sapnous-6B" | |
| config = AutoConfig.from_pretrained(model_path, trust_remote_code=True) | |
| model = AutoModel.from_pretrained(model_path, config=config, trust_remote_code=True) | |
| print("Model loaded successfully!") | |