Views
No views yet
llama.cpp backend.llama-server chat completions API. The bundled
humanspeech.jpg sample has been validated on both K1 and K3.1FastVLM-0.5B-SpacemiT/
2├── fastvlm-text-0.5B-Q4_1.gguf
3├── fastvlm_vision.f16.onnx
4├── configs/
5│ ├── K1/config.json
6│ └── K3/config.json
7├── humanspeech.jpg
8└── README.mdhumanspeech.jpg shows a woman speaking at a podium and is used
by the board smoke example below. fastvlm_vision.f16.onnx is the vision encoder;
fastvlm-text-0.5B-Q4_1.gguf is the text decoder.| Platform | Accelerated cores | SMT config | llama-server threads |
|---|---|---|---|
| SpacemiT K1 / X60 | 0,1,2,3 | configs/K1 | -t 4 |
| SpacemiT K3 / A100 | 8,9,10,11,12,13,14,15 | configs/K3 | -t 8 |
config.json controls the ONNX vision encoder's
SpaceMIT EP thread count and affinity. The -t argument controls the GGUF
text decoder. Do not use the K3 config on K1: K1 has four accelerated cores at
IDs 0-3, whereas K3 has eight accelerated cores at IDs 8-15.llama.cpp runtime automatically detects the accelerated CPU
cores. Normal runs do not require manually setting
SPACEMIT_PERFER_CORE_ARCH, SPACEMIT_PERFER_CORE_ID, or
SPACEMIT_MEM_BACKEND.libonnxruntime and the
SpacemiT Execution Provider:
spacemit-com/onnxruntime releasesllama.cpp build containing llama-server:
spacemit-com/llama.cpp2.0.6 and a RISC-V
llama-server built from the SpacemiT fork.1wget https://github.com/spacemit-com/onnxruntime/releases/download/2.0.6/spacemit-ort.riscv64.2.0.6.tar.gz
2tar -xf spacemit-ort.riscv64.2.0.6.tar.gz
3
4wget https://github.com/spacemit-com/llama.cpp/releases/download/v0.1.7/spacemit-llama.cpp.riscv64.0.1.7.tar.gz
5tar -xf spacemit-llama.cpp.riscv64.0.1.7.tar.gz1git clone --recursive https://github.com/spacemit-com/llama.cpp.git
2cd llama.cpp
3
4export RISCV_ROOT_PATH=/path/to/spacemit-riscv-toolchain
5export SPACEMIT_ORT_DIR=/path/to/spacemit-ort.riscv64.2.0.6
6
7bash build_spacemit.sh glibcbuild/installed/. An equivalent
manual CMake build must enable at least GGML_CPU_RISCV64_SPACEMIT=ON and
LLAMA_SERVER_SMT_MTMD=ON, and pass SPACEMIT_ORT_DIR to CMake.llama.cpp installation to the board. Set the following paths to match
their actual locations:1export MODEL_DIR=/path/to/FastVLM-0.5B-SpacemiT
2export ORT_DIR=/path/to/spacemit-ort.riscv64.2.0.6
3export LLAMA_DIR=/path/to/spacemit-llama.cpp.riscv64.0.1.7
4
5export LD_LIBRARY_PATH="${LLAMA_DIR}/lib:${ORT_DIR}/lib:${LD_LIBRARY_PATH:-}"0-3:1"${LLAMA_DIR}/bin/llama-server" \
2 -m "${MODEL_DIR}/fastvlm-text-0.5B-Q4_1.gguf" \
3 --media-backend smt \
4 --smt-config-dir "${MODEL_DIR}/configs/K1" \
5 -t 4 \
6 --host 0.0.0.0 \
7 --port 8080 \
8 --warmup1"ep_config": {
2 "SPACEMIT_EP_INTRA_THREAD_NUM": "4",
3 "SPACEMIT_EP_INTER_THREAD_NUM": "1",
4 "SPACEMIT_EP_INTRA_THREAD_AFFINITY": "0;1;2;3"
5}8-15:1"${LLAMA_DIR}/bin/llama-server" \
2 -m "${MODEL_DIR}/fastvlm-text-0.5B-Q4_1.gguf" \
3 --media-backend smt \
4 --smt-config-dir "${MODEL_DIR}/configs/K3" \
5 -t 8 \
6 --host 0.0.0.0 \
7 --port 8080 \
8 --warmup1"ep_config": {
2 "SPACEMIT_EP_INTRA_THREAD_NUM": "8",
3 "SPACEMIT_EP_INTER_THREAD_NUM": "1",
4 "SPACEMIT_EP_INTRA_THREAD_AFFINITY": "8;9;10;11;12;13;14;15"
5}llama_server: listening on http://0.0.0.0:80800.0.0.0 endpoint.SERVER_URL=http://127.0.0.1:8080 when testing locally,
or replace BOARD_IP when testing remotely.1export SERVER_URL=http://127.0.0.1:8080
2
3base64 < "${MODEL_DIR}/humanspeech.jpg" | tr -d '\n' | jq -Rs '{
4 messages: [
5 {
6 role: "user",
7 content: [
8 {
9 type: "image_url",
10 image_url: {
11 url: ("data:image/jpeg;base64," + .)
12 }
13 },
14 {
15 type: "text",
16 text: "Describe the image content."
17 }
18 ]
19 }
20 ],
21 max_tokens: 64,
22 temperature: 0,
23 stream: false,
24 chat_template_kwargs: {
25 enable_thinking: false
26 }
27}' | curl "${SERVER_URL}/v1/chat/completions" \
28 -H "Content-Type: application/json" \
29 --data-binary @-choices[0].message.content. Replace
humanspeech.jpg with another JPEG/PNG image to describe your own image.humanspeech.jpg was tested on 2026-08-10 with --warmup enabled.
Both boards returned HTTP 200 and generated a description of the speaker,
podium, microphone, clothing, and background banner. With max_tokens=64,
the responses were truncated at the requested token limit.The image depicts a woman standing at a podium, delivering a speech or presentation. She is positioned at the center of the frame, with her right hand raised, holding a microphone close to her mouth, suggesting she is speaking. She is dressed in a patterned top and dark pants. Behind her, there is a bannerThe image depicts a woman standing at a podium, delivering a speech or presentation. She is positioned at the center of the frame, with her right hand raised, holding a microphone close to her mouth, suggesting she is actively speaking. She is dressed in a patterned top and dark pants. Behind her, there is a| Board | HTTP status | Wall time |
|---|---|---|
K1 (0-3, -t 4) | 200 | 9.79 s |
K3 (8-15, -t 8) | 200 | 1.91 s |
1@InProceedings{fastvlm2025,
2 author = {Pavan Kumar Anasosalu Vasu and Fartash Faghri and Chun-Liang Li and Cem Koc and Nate True and Albert Antony and Gokul Santhanam and James Gabriel and Peter Grasch and Oncel Tuzel and Hadi Pouransari},
3 title = {FastVLM: Efficient Vision Encoding for Vision Language Models},
4 booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
5 month = {June},
6 year = {2025},
7}LICENSE_MODEL for the terms that apply to the model.
The SpacemiT llama.cpp and ONNX Runtime packages are separate dependencies
and remain subject to their respective repository licenses.