Image-Text-to-Text
Transformers
Diffusers
Safetensors
qwen3_vl
vision-language-model
image-decomposition
conversational
Instructions to use SynLayers/Bbox-caption-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SynLayers/Bbox-caption-8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="SynLayers/Bbox-caption-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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("SynLayers/Bbox-caption-8b") model = AutoModelForImageTextToText.from_pretrained("SynLayers/Bbox-caption-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?"} ] }, ] 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use SynLayers/Bbox-caption-8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SynLayers/Bbox-caption-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": "SynLayers/Bbox-caption-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/SynLayers/Bbox-caption-8b
- SGLang
How to use SynLayers/Bbox-caption-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 "SynLayers/Bbox-caption-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": "SynLayers/Bbox-caption-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 "SynLayers/Bbox-caption-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": "SynLayers/Bbox-caption-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 SynLayers/Bbox-caption-8b with Docker Model Runner:
docker model run hf.co/SynLayers/Bbox-caption-8b
| from __future__ import annotations | |
| import argparse | |
| import os | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| PROJECT_ROOT = Path(__file__).resolve().parents[1] | |
| STATIC_FILE_MAP = { | |
| PROJECT_ROOT / "demo" / "__init__.py": "demo/__init__.py", | |
| PROJECT_ROOT / "demo" / "app.py": "app.py", | |
| PROJECT_ROOT / "demo" / "hf_repo_assets.py": "demo/hf_repo_assets.py", | |
| PROJECT_ROOT / "demo" / "README.md": "README.md", | |
| PROJECT_ROOT / "demo" / "publish_space.py": "demo/publish_space.py", | |
| PROJECT_ROOT / "demo" / "requirements-hf-space.txt": "requirements.txt", | |
| PROJECT_ROOT / "demo" / "real_world_pipeline.py": "demo/real_world_pipeline.py", | |
| PROJECT_ROOT / "demo" / "upload_used_bundle_to_hf.py": "demo/upload_used_bundle_to_hf.py", | |
| PROJECT_ROOT / "demo" / "infer" / "__init__.py": "demo/infer/__init__.py", | |
| PROJECT_ROOT / "demo" / "infer" / "run_caption_bbox_infer.py": "demo/infer/run_caption_bbox_infer.py", | |
| PROJECT_ROOT / "demo" / "infer" / "vlm_bbox_inference.py": "demo/infer/vlm_bbox_inference.py", | |
| PROJECT_ROOT / "infer" / "__init__.py": "infer/__init__.py", | |
| PROJECT_ROOT / "infer" / "common_infer.py": "infer/common_infer.py", | |
| PROJECT_ROOT / "infer" / "infer.py": "infer/infer.py", | |
| PROJECT_ROOT / "infer" / "infer.yaml": "infer/infer.yaml", | |
| PROJECT_ROOT / "models" / "__init__.py": "models/__init__.py", | |
| PROJECT_ROOT / "models" / "mmdit.py": "models/mmdit.py", | |
| PROJECT_ROOT / "models" / "multiLayer_adapter.py": "models/multiLayer_adapter.py", | |
| PROJECT_ROOT / "models" / "pipeline.py": "models/pipeline.py", | |
| PROJECT_ROOT / "models" / "transp_vae.py": "models/transp_vae.py", | |
| PROJECT_ROOT / "tools" / "__init__.py": "tools/__init__.py", | |
| PROJECT_ROOT / "tools" / "tools.py": "tools/tools.py", | |
| } | |
| def iter_uploads(): | |
| for local_path, remote_path in STATIC_FILE_MAP.items(): | |
| if local_path.exists(): | |
| yield local_path, remote_path | |
| def main(): | |
| parser = argparse.ArgumentParser( | |
| description="Create or update a Hugging Face Space for the SynLayers demo." | |
| ) | |
| parser.add_argument("--repo-id", type=str, required=True, help="Target Space repo id, e.g. SynLayers/synlayers-demo") | |
| parser.add_argument("--token", type=str, default=os.environ.get("HF_TOKEN")) | |
| parser.add_argument("--private", action="store_true", help="Create the Space as private") | |
| args = parser.parse_args() | |
| if not args.token: | |
| raise ValueError("Missing Hugging Face token. Pass --token or set HF_TOKEN.") | |
| api = HfApi(token=args.token) | |
| api.create_repo( | |
| repo_id=args.repo_id, | |
| repo_type="space", | |
| private=args.private, | |
| space_sdk="gradio", | |
| exist_ok=True, | |
| ) | |
| for local_path, remote_path in iter_uploads(): | |
| print(f"Uploading {local_path} -> {remote_path}") | |
| api.upload_file( | |
| path_or_fileobj=str(local_path), | |
| path_in_repo=remote_path, | |
| repo_id=args.repo_id, | |
| repo_type="space", | |
| ) | |
| print("") | |
| print(f"Space scaffold uploaded to https://huggingface.co/spaces/{args.repo_id}") | |
| print("Model assets are not uploaded by this helper; configure them in Space storage or env vars before running.") | |
| if __name__ == "__main__": | |
| main() | |