How to use from
llama.cppInstall from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf ewre324/moondream2:F16# Run inference directly in the terminal:
llama-cli -hf ewre324/moondream2:F16Use 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 ewre324/moondream2:F16# Run inference directly in the terminal:
./llama-cli -hf ewre324/moondream2:F16Build 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 ewre324/moondream2:F16# Run inference directly in the terminal:
./build/bin/llama-cli -hf ewre324/moondream2:F16Use Docker
docker model run hf.co/ewre324/moondream2:F16Quick Links
Model for Gaze detection
/ Colab Demo / GitHub
Original Model card follows below:
Moondream is a small vision language model designed to run efficiently on edge devices.
This repository contains the latest (2025-01-09) 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-01-09",
trust_remote_code=True,
# Uncomment to run on GPU.
# device_map={"": "cuda"}
)
# 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)")
- Downloads last month
- 486
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf ewre324/moondream2:F16# Run inference directly in the terminal: llama-cli -hf ewre324/moondream2:F16