Instructions to use bunny127/SophiaVL-R1-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bunny127/SophiaVL-R1-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="bunny127/SophiaVL-R1-7B") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("bunny127/SophiaVL-R1-7B") model = AutoModelForMultimodalLM.from_pretrained("bunny127/SophiaVL-R1-7B", device_map="auto") 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bunny127/SophiaVL-R1-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bunny127/SophiaVL-R1-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bunny127/SophiaVL-R1-7B", "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/bunny127/SophiaVL-R1-7B
- SGLang
How to use bunny127/SophiaVL-R1-7B 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 "bunny127/SophiaVL-R1-7B" \ --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": "bunny127/SophiaVL-R1-7B", "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 "bunny127/SophiaVL-R1-7B" \ --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": "bunny127/SophiaVL-R1-7B", "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 bunny127/SophiaVL-R1-7B with Docker Model Runner:
docker model run hf.co/bunny127/SophiaVL-R1-7B
Commit History
-
Upload model-00001-of-00004.safetensors
Verified signature4f4f5ca -
Upload model-00002-of-00004.safetensors
Verified signatureb689ffc -
Upload model-00003-of-00004.safetensors
Verified signatured689f6d -
Upload model-00004-of-00004.safetensors
Verified signaturebd54152 -
Upload 11 files
Verified signature2d4c368 -
Delete vocab.json
Verified signature6a5e87d -
Delete tokenizer_config.json
Verified signature1e3976b -
Delete tokenizer.json
Verified signature5299568 -
Delete preprocessor_config.json
Verified signature69d9fb5 -
Delete model.safetensors.index.json
Verified signaturee17e049 -
Delete config.json
Verified signature85e7094 -
Delete merges.txt
Verified signature41d06df -
Delete special_tokens_map.json
Verified signature9ee90d4 -
Delete chat_template.json
Verified signatureeb88849 -
Delete generation_config.json
Verified signature0bb8965 -
Delete added_tokens.json
Verified signature5d616de -
Delete .gitattributes
Verified signaturee23609a -
Delete model-00004-of-00004.safetensors
Verified signaturee5be965 -
Delete model-00003-of-00004.safetensors
Verified signature310da88 -
Delete model-00002-of-00004.safetensors
Verified signaturee1e1175 -
Delete model-00001-of-00004.safetensors
Verified signature880da30
-
Improve model card by adding pipeline tag and library name (#1)
Verified signature- Improve model card by adding pipeline tag and library name (8af9dec570e3b7f0b40db9eec01922e317d41b72) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>869a52d
-
Update README.md
Verified signature9f88871
-
Update README.md
Verified signature4854769 -
Update README.md
Verified signatureb7bced5 -
Update README.md
Verified signature5cc6480 -
Upload 7 files
Verified signature97ef468 -
Upload 4 files
Verified signatureba27c89
-
Upload model-00004-of-00004.safetensors
Verified signature47efd52 -
Upload model-00003-of-00004.safetensors
Verified signature3104e7a -
commit 1-2
Verified signature49eed6b -
initial commit
Verified signature7a8602e