Instructions to use cksghl1004/cpp_moondream2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use cksghl1004/cpp_moondream2 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cksghl1004/cpp_moondream2", filename="moondream2-mmproj-f16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cksghl1004/cpp_moondream2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf cksghl1004/cpp_moondream2:F16 # Run inference directly in the terminal: llama cli -hf cksghl1004/cpp_moondream2:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf cksghl1004/cpp_moondream2:F16 # Run inference directly in the terminal: llama cli -hf cksghl1004/cpp_moondream2:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf cksghl1004/cpp_moondream2:F16 # Run inference directly in the terminal: ./llama-cli -hf cksghl1004/cpp_moondream2:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf cksghl1004/cpp_moondream2:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf cksghl1004/cpp_moondream2:F16
Use Docker
docker model run hf.co/cksghl1004/cpp_moondream2:F16
- LM Studio
- Jan
- vLLM
How to use cksghl1004/cpp_moondream2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cksghl1004/cpp_moondream2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cksghl1004/cpp_moondream2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cksghl1004/cpp_moondream2:F16
- Ollama
How to use cksghl1004/cpp_moondream2 with Ollama:
ollama run hf.co/cksghl1004/cpp_moondream2:F16
- Unsloth Studio
How to use cksghl1004/cpp_moondream2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for cksghl1004/cpp_moondream2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for cksghl1004/cpp_moondream2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for cksghl1004/cpp_moondream2 to start chatting
- Atomic Chat new
- Docker Model Runner
How to use cksghl1004/cpp_moondream2 with Docker Model Runner:
docker model run hf.co/cksghl1004/cpp_moondream2:F16
- Lemonade
How to use cksghl1004/cpp_moondream2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cksghl1004/cpp_moondream2:F16
Run and chat with the model
lemonade run user.cpp_moondream2-F16
List all available models
lemonade list
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex
# Run unsloth studio
unsloth studio -H 0.0.0.0 -p 8888
# Then open http://localhost:8888 in your browser
# Search for cksghl1004/cpp_moondream2 to start chattingUsing HuggingFace Spaces for Unsloth
# No setup required# Open https://huggingface.co/spaces/unsloth/studio in your browser
# Search for cksghl1004/cpp_moondream2 to start chattingMoondream is a small vision language model designed to run efficiently everywhere.
This repository contains the latest (2025-06-21) release of Moondream, as well as historical releases. The model is updated frequently, so we recommend specifying a revision as shown below if you're using it in a production application.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from PIL import Image
model = AutoModelForCausalLM.from_pretrained(
"vikhyatk/moondream2",
revision="2025-06-21",
trust_remote_code=True,
device_map={"": "cuda"} # ...or 'mps', on Apple Silicon
)
# Captioning
print("Short caption:")
print(model.caption(image, length="short")["caption"])
print("\nNormal caption:")
for t in model.caption(image, length="normal", stream=True)["caption"]:
# Streaming generation example, supported for caption() and detect()
print(t, end="", flush=True)
print(model.caption(image, length="normal"))
# Visual Querying
print("\nVisual query: 'How many people are in the image?'")
print(model.query(image, "How many people are in the image?")["answer"])
# Object Detection
print("\nObject detection: 'face'")
objects = model.detect(image, "face")["objects"]
print(f"Found {len(objects)} face(s)")
# Pointing
print("\nPointing: 'person'")
points = model.point(image, "person")["points"]
print(f"Found {len(points)} person(s)")
Changelog
2025-06-21
(release notes coming soon)
2025-04-15 (full release notes)
- Improved chart understanding (ChartQA up from 74.8 to 77.5, 82.2 with PoT)
- Added temperature and nucleus sampling to reduce repetitive outputs
- Better OCR for documents and tables (prompt with “Transcribe the text” or “Transcribe the text in natural reading order”)
- Object detection supports document layout detection (figure, formula, text, etc)
- UI understanding (ScreenSpot F1@0.5 up from 53.3 to 60.3)
- Improved text understanding (DocVQA up from 76.5 to 79.3, TextVQA up from 74.6 to 76.3)
2025-03-27 (full release notes)
- Added support for long-form captioning
- Open vocabulary image tagging
- Improved counting accuracy (e.g. CountBenchQA increased from 80 to 86.4)
- Improved text understanding (e.g. OCRBench increased from 58.3 to 61.2)
- Improved object detection, especially for small objects (e.g. COCO up from 30.5 to 51.2)
- Fixed token streaming bug affecting multi-byte unicode characters
- gpt-fast style
compile()now supported in HF Transformers implementation
- Downloads last month
- 170
Install Unsloth Studio (macOS, Linux, WSL)
# Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for cksghl1004/cpp_moondream2 to start chatting