Instructions to use ewre324/moondream2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ewre324/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 ewre324/moondream2:F16 # Run inference directly in the terminal: llama cli -hf ewre324/moondream2:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ewre324/moondream2:F16 # Run inference directly in the terminal: llama cli -hf ewre324/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 ewre324/moondream2:F16 # Run inference directly in the terminal: ./llama-cli -hf ewre324/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 ewre324/moondream2:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ewre324/moondream2:F16
Use Docker
docker model run hf.co/ewre324/moondream2:F16
- LM Studio
- Jan
- vLLM
How to use ewre324/moondream2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ewre324/moondream2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ewre324/moondream2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ewre324/moondream2:F16
- Ollama
How to use ewre324/moondream2 with Ollama:
ollama run hf.co/ewre324/moondream2:F16
- Unsloth Desktop
- Docker Model Runner
How to use ewre324/moondream2 with Docker Model Runner:
docker model run hf.co/ewre324/moondream2:F16
- Lemonade
How to use ewre324/moondream2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ewre324/moondream2:F16
Run and chat with the model
lemonade run user.moondream2-F16
List all available models
lemonade list
- Atomic Chat
Download config.py from ewre324/moondream2: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/ewre324/moondream2/resolve/main/config.py
- Command line
-
hf download hf://ewre324/moondream2/config.py
-
curl -L -o config.py https://huggingface.co/ewre324/moondream2/resolve/main/config.py
2.38 kB
| from dataclasses import dataclass, field | |
| from typing import Dict, List, Optional | |
| class TextConfig: | |
| dim: int = 2048 | |
| n_layers: int = 24 | |
| vocab_size: int = 51200 | |
| max_context: int = 2048 | |
| n_heads: int = 32 | |
| prefix_attn: int = 730 | |
| class VisionConfig: | |
| enc_dim: int = 1152 | |
| enc_patch_size: int = 14 | |
| enc_n_layers: int = 27 | |
| enc_ff_dim: int = 4304 | |
| enc_n_heads: int = 16 | |
| proj_out_dim: int = 2048 | |
| crop_size: int = 378 | |
| in_channels: int = 3 | |
| max_crops: int = 12 | |
| overlap_margin: int = 4 | |
| proj_inner_dim: int = 8192 | |
| class RegionConfig: | |
| dim: int = 2048 | |
| coord_feat_dim: int = 256 | |
| coord_out_dim: int = 1024 | |
| size_feat_dim: int = 512 | |
| size_out_dim: int = 2048 | |
| inner_dim: int = 8192 | |
| class TokenizerConfig: | |
| bos_id: int = 50256 | |
| eos_id: int = 50256 | |
| templates: Dict[str, Optional[Dict[str, List[int]]]] = field( | |
| default_factory=lambda: { | |
| "caption": { | |
| "short": [198, 198, 16438, 8305, 25], | |
| "normal": [198, 198, 24334, 1159, 25], | |
| }, | |
| "query": {"prefix": [198, 198, 24361, 25], "suffix": [198, 198, 33706, 25]}, | |
| "detect": {"prefix": [198, 198, 47504, 25], "suffix": [628]}, | |
| "point": {"prefix": [198, 198, 12727, 25], "suffix": [628]}, | |
| } | |
| ) | |
| class MoondreamConfig: | |
| text: TextConfig = TextConfig() | |
| vision: VisionConfig = VisionConfig() | |
| region: RegionConfig = RegionConfig() | |
| tokenizer: TokenizerConfig = TokenizerConfig() | |
| def from_dict(cls, config_dict: dict): | |
| text_config = TextConfig(**config_dict.get("text", {})) | |
| vision_config = VisionConfig(**config_dict.get("vision", {})) | |
| region_config = RegionConfig(**config_dict.get("region", {})) | |
| tokenizer_config = TokenizerConfig(**config_dict.get("tokenizer", {})) | |
| return cls( | |
| text=text_config, | |
| vision=vision_config, | |
| region=region_config, | |
| tokenizer=tokenizer_config, | |
| ) | |
| def to_dict(self): | |
| return { | |
| "text": self.text.__dict__, | |
| "vision": self.vision.__dict__, | |
| "region": self.region.__dict__, | |
| "tokenizer": self.tokenizer.__dict__, | |
| } | |