Image-Text-to-Text
Transformers
Safetensors
English
Chinese
sensenova_loop
text-generation
nvfp4
modelopt
quantized
multimodal
looped-transformer
mhc
mtp
custom_code
conversational
8-bit precision
Instructions to use gitcommit90/SenseNova-Loop-9B-Preview-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gitcommit90/SenseNova-Loop-9B-Preview-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gitcommit90/SenseNova-Loop-9B-Preview-NVFP4", 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("gitcommit90/SenseNova-Loop-9B-Preview-NVFP4", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gitcommit90/SenseNova-Loop-9B-Preview-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gitcommit90/SenseNova-Loop-9B-Preview-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gitcommit90/SenseNova-Loop-9B-Preview-NVFP4", "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/gitcommit90/SenseNova-Loop-9B-Preview-NVFP4
- SGLang
How to use gitcommit90/SenseNova-Loop-9B-Preview-NVFP4 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 "gitcommit90/SenseNova-Loop-9B-Preview-NVFP4" \ --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": "gitcommit90/SenseNova-Loop-9B-Preview-NVFP4", "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 "gitcommit90/SenseNova-Loop-9B-Preview-NVFP4" \ --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": "gitcommit90/SenseNova-Loop-9B-Preview-NVFP4", "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 gitcommit90/SenseNova-Loop-9B-Preview-NVFP4 with Docker Model Runner:
docker model run hf.co/gitcommit90/SenseNova-Loop-9B-Preview-NVFP4
Download runtime-v2/serve_sglang.sh from gitcommit90/SenseNova-Loop-9B-Preview-NVFP4: direct link, hf CLI and curl.
- Browser
- Download file 3.45 kB
-
https://huggingface.co/gitcommit90/SenseNova-Loop-9B-Preview-NVFP4/resolve/main/runtime-v2/serve_sglang.sh
- Command line
-
hf download hf://gitcommit90/SenseNova-Loop-9B-Preview-NVFP4/runtime-v2/serve_sglang.sh
-
curl -L -o serve_sglang.sh https://huggingface.co/gitcommit90/SenseNova-Loop-9B-Preview-NVFP4/resolve/main/runtime-v2/serve_sglang.sh
3.45 kB
| # Serve SenseNova-Loop-9B-Preview-NVFP4 (W4A4 NVFP4 + MTP) with the optimized runtime v2 (DGX Spark / GB10, SM121). | |
| # | |
| # serve_sglang.sh [MODEL_DIR] [--no-mtp] [extra sglang args...] | |
| # | |
| # MODEL_DIR defaults to the directory containing this runtime folder. Binds 127.0.0.1:${PORT:-30080}. | |
| # Same pinned image, PR #47281 overlay and patches as the v1 release runtime, plus: | |
| # * fused Triton mHC router kernels (overlay/.../layers/sensenova_mhc_fused.py) | |
| # MHC_MODE=fast (default) single-kernel FP32 rmsnorm+linear+Sinkhorn(20 it)+branch, fused merge | |
| # MHC_MODE=exact fused bitwise-exact Sinkhorn, cuBLAS FP32 router linear + torch merge | |
| # (greedy outputs bitwise identical to the v1 runtime) | |
| # MHC_MODE=reference original eager PyTorch router (v1 behaviour and speed) | |
| # * FR-Spec hot-vocab draft head for MTP: TOKEN_MAP=<runtime>/tokenmap/hot_64k.pt (default) | none. | |
| # Only the draft proposes from the 64k ids; the target verifies against the full vocabulary. | |
| # FP4 GEMMs: flashinfer cuDNN backend (native W4A4 block-scaled FP4 tensor-core kernels). | |
| set -euo pipefail | |
| HERE=$(cd "$(dirname "$0")" && pwd) | |
| MODEL=$(realpath "${1:-$HERE/..}"); [ $# -gt 0 ] && shift | |
| CACHE=${SGL_CACHE:-$HOME/.cache/sensenova-sglang}; mkdir -p "$CACHE" | |
| IMG=lmsysorg/sglang:nightly-dev-cu13-20261029-c10e0e17@sha256:78142f9f4b7fb3ee27f59065615dc7bb263f643ed256c9299c3861086ade4d47 | |
| SGL=/sgl-workspace/sglang/python/sglang | |
| OVL=${OVERLAY:-$HERE/overlay}/python/sglang | |
| case "${MHC_MODE:-fast}" in | |
| fast) MHC_ENV=(-e SENSENOVA_MHC_FUSED=1 -e SENSENOVA_MHC_FUSED_LINEAR=1 -e SENSENOVA_MHC_FUSED_MERGE=1) ;; | |
| exact) MHC_ENV=(-e SENSENOVA_MHC_FUSED=1 -e SENSENOVA_MHC_FUSED_LINEAR=0 -e SENSENOVA_MHC_FUSED_MERGE=0) ;; | |
| reference) MHC_ENV=(-e SENSENOVA_MHC_FUSED=0) ;; | |
| *) echo "MHC_MODE must be fast|exact|reference" >&2; exit 2 ;; | |
| esac | |
| TOKEN_MAP=${TOKEN_MAP:-$HERE/tokenmap/hot_64k.pt} | |
| SPEC=(--speculative-algorithm NEXTN --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4) | |
| AUX=() | |
| if [ "$TOKEN_MAP" != none ]; then | |
| TOKEN_MAP=$(realpath "$TOKEN_MAP") | |
| AUX=(-v "$TOKEN_MAP:/aux/token_map.pt:ro"); SPEC+=(--speculative-token-map /aux/token_map.pt) | |
| fi | |
| if [ "${1:-}" = "--no-mtp" ]; then SPEC=(); shift; fi | |
| MOUNTS=() | |
| for f in $(cd "$OVL" && find . -name '*.py'); do MOUNTS+=(-v "$OVL/${f#./}:$SGL/${f#./}:ro"); done | |
| NAME=${NAME:-sensenova-loop-nvfp4} | |
| docker rm -f "$NAME" >/dev/null 2>&1 || true | |
| docker run -d --name "$NAME" --gpus all --ipc=host --network host \ | |
| --ulimit memlock=-1 --ulimit stack=67108864 \ | |
| -e PYTHONDONTWRITEBYTECODE=1 \ | |
| -e SGLANG_DISABLE_SILU_FP4_QUANT_FUSION="${SGLANG_DISABLE_SILU_FP4_QUANT_FUSION:-0}" \ | |
| "${MHC_ENV[@]}" \ | |
| -v "$MODEL:/model:ro" "${MOUNTS[@]}" "${AUX[@]}" \ | |
| -v "$CACHE:/root/.cache" \ | |
| ${DOCKER_EXTRA:-} \ | |
| --entrypoint python3 "$IMG" -m sglang.launch_server \ | |
| --model-path /model --served-model-name "${SERVED:-sensenova-loop-9b-nvfp4}" \ | |
| --host "${HOST:-127.0.0.1}" --port "${PORT:-30080}" \ | |
| --dtype bfloat16 --fp4-gemm-backend flashinfer_cudnn \ | |
| --mem-fraction-static "${MEMFRAC:-0.45}" --context-length "${CTX:-32768}" --max-running-requests "${MAXREQ:-16}" \ | |
| --reasoning-parser qwen3 --tool-call-parser qwen3_coder \ | |
| "${SPEC[@]}" "$@" | |
| echo "started container $NAME (MHC_MODE=${MHC_MODE:-fast}, token map: ${TOKEN_MAP}); wait for: curl -s http://${HOST:-127.0.0.1}:${PORT:-30080}/v1/models" | |