Image-Text-to-Text
Transformers
Safetensors
English
Chinese
sensenova_loop
text-generation
multimodal
looped-transformer
mhc
custom_code
conversational
Instructions to use sensenova/SenseNova-Loop-9B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sensenova/SenseNova-Loop-9B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="sensenova/SenseNova-Loop-9B-Preview", 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("sensenova/SenseNova-Loop-9B-Preview", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sensenova/SenseNova-Loop-9B-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sensenova/SenseNova-Loop-9B-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sensenova/SenseNova-Loop-9B-Preview", "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/sensenova/SenseNova-Loop-9B-Preview
- SGLang
How to use sensenova/SenseNova-Loop-9B-Preview 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 "sensenova/SenseNova-Loop-9B-Preview" \ --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": "sensenova/SenseNova-Loop-9B-Preview", "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 "sensenova/SenseNova-Loop-9B-Preview" \ --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": "sensenova/SenseNova-Loop-9B-Preview", "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 sensenova/SenseNova-Loop-9B-Preview with Docker Model Runner:
docker model run hf.co/sensenova/SenseNova-Loop-9B-Preview
|
Download assets/loop9b-architecture.svg from sensenova/SenseNova-Loop-9B-Preview: direct link, hf CLI and curl.
- Browser
- Download file 3.16 kB
-
https://huggingface.co/sensenova/SenseNova-Loop-9B-Preview/resolve/main/assets/loop9b-architecture.svg
- Command line
-
hf download hf://sensenova/SenseNova-Loop-9B-Preview/assets/loop9b-architecture.svg
-
curl -L -o loop9b-architecture.svg https://huggingface.co/sensenova/SenseNova-Loop-9B-Preview/resolve/main/assets/loop9b-architecture.svg
3.16 kB
| <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="380" viewBox="0 0 1200 380" role="img" aria-labelledby="title desc"> | |
| <title id="title">Loop-9B execution overview</title> | |
| <desc id="desc">Text and image inputs pass through early layers, then through the same layers 4 to 27 twice with two mHC residual streams, then through the remaining layers to generate text.</desc> | |
| <defs> | |
| <marker id="arrow" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto"><path d="M 0 0 L 9 4.5 L 0 9 z" fill="#877b98"/></marker> | |
| </defs> | |
| <rect width="1200" height="380" rx="20" fill="#ffffff"/> | |
| <text x="48" y="52" font-family="Arial, sans-serif" font-size="24" font-weight="700" fill="#302447">Loop-9B · execution overview</text> | |
| <text x="48" y="79" font-family="Arial, sans-serif" font-size="14" fill="#615174">A repeated block adds computation while reusing its weights</text> | |
| <g font-family="Arial, sans-serif" text-anchor="middle"> | |
| <rect x="42" y="151" width="132" height="86" rx="12" fill="#f1edf8"/> | |
| <text x="108" y="187" font-size="17" font-weight="700" fill="#302447">Input</text> | |
| <text x="108" y="211" font-size="13" fill="#615174">text + image</text> | |
| <rect x="205" y="151" width="138" height="86" rx="12" fill="#ede7f8"/> | |
| <text x="274" y="187" font-size="17" font-weight="700" fill="#4a3573">Early layers</text> | |
| <text x="274" y="211" font-size="13" fill="#5c516d">0–3</text> | |
| <rect x="374" y="105" width="532" height="181" rx="18" fill="#f8f5fc" stroke="#d1c3e8" stroke-width="2"/> | |
| <text x="640" y="134" font-size="15" font-weight="700" fill="#5e478a">SHARED BLOCK · LAYERS 4–27 · mHC 2 STREAMS</text> | |
| <rect x="407" y="165" width="189" height="70" rx="10" fill="#8f73c7"/> | |
| <text x="501" y="194" font-size="17" font-weight="700" fill="#ffffff">Pass 1</text> | |
| <text x="501" y="215" font-size="13" fill="#ede7f8">layers 4–27</text> | |
| <rect x="684" y="165" width="189" height="70" rx="10" fill="#8f73c7"/> | |
| <text x="778" y="194" font-size="17" font-weight="700" fill="#ffffff">Pass 2</text> | |
| <text x="778" y="215" font-size="13" fill="#ede7f8">same weights</text> | |
| <text x="640" y="265" font-size="13" fill="#615174">Two passes; one set of block parameters</text> | |
| <rect x="937" y="151" width="131" height="86" rx="12" fill="#ede7f8"/> | |
| <text x="1002" y="187" font-size="16" font-weight="700" fill="#4a3573">Final layers</text> | |
| <text x="1002" y="211" font-size="13" fill="#5c516d">and head</text> | |
| <rect x="1095" y="151" width="70" height="86" rx="12" fill="#f1edf8"/> | |
| <text x="1130" y="187" font-size="15" font-weight="700" fill="#302447">Text</text> | |
| <text x="1130" y="208" font-size="15" font-weight="700" fill="#302447">output</text> | |
| </g> | |
| <g fill="none" stroke="#877b98" stroke-width="2.5" marker-end="url(#arrow)"> | |
| <path d="M174 194 H199"/><path d="M343 194 H401"/><path d="M596 200 H678"/><path d="M873 194 H931"/><path d="M1068 194 H1089"/> | |
| </g> | |
| <text x="48" y="341" font-family="Arial, sans-serif" font-size="13" fill="#877b98">Schematic · Layer indices are zero-based · Not all internal operations are shown</text> | |
| </svg> | |