Instructions to use Mharbulous/moondream2-syncopaid 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 Mharbulous/moondream2-syncopaid 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 Mharbulous/moondream2-syncopaid:F16 # Run inference directly in the terminal: llama cli -hf Mharbulous/moondream2-syncopaid:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Mharbulous/moondream2-syncopaid:F16 # Run inference directly in the terminal: llama cli -hf Mharbulous/moondream2-syncopaid: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 Mharbulous/moondream2-syncopaid:F16 # Run inference directly in the terminal: ./llama-cli -hf Mharbulous/moondream2-syncopaid: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 Mharbulous/moondream2-syncopaid:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Mharbulous/moondream2-syncopaid:F16
Use Docker
docker model run hf.co/Mharbulous/moondream2-syncopaid:F16
- LM Studio
- Jan
- vLLM
How to use Mharbulous/moondream2-syncopaid with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mharbulous/moondream2-syncopaid" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mharbulous/moondream2-syncopaid", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mharbulous/moondream2-syncopaid:F16
- Ollama
How to use Mharbulous/moondream2-syncopaid with Ollama:
ollama run hf.co/Mharbulous/moondream2-syncopaid:F16
- Unsloth Studio
How to use Mharbulous/moondream2-syncopaid 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 Mharbulous/moondream2-syncopaid 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 Mharbulous/moondream2-syncopaid to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Mharbulous/moondream2-syncopaid to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Mharbulous/moondream2-syncopaid with Docker Model Runner:
docker model run hf.co/Mharbulous/moondream2-syncopaid:F16
- Lemonade
How to use Mharbulous/moondream2-syncopaid with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Mharbulous/moondream2-syncopaid:F16
Run and chat with the model
lemonade run user.moondream2-syncopaid-F16
List all available models
lemonade list
| import functools | |
| import os | |
| import shutil | |
| import torch | |
| from pathlib import Path | |
| from urllib.request import Request, urlopen | |
| from typing import Optional | |
| def variant_cache_dir(): | |
| hf_hub_cache = os.environ.get("HF_HUB_CACHE") | |
| if hf_hub_cache is not None: | |
| return Path(hf_hub_cache) / "md_variants" | |
| hf_home = os.environ.get("HF_HOME") | |
| if hf_home is not None: | |
| return Path(hf_home) / "hub" / "md_variants" | |
| return Path("~/.cache/huggingface/hub").expanduser() / "md_variants" | |
| def cached_variant_path(variant_id: str): | |
| variant, *rest = variant_id.split("/", 1) | |
| step = rest[0] if rest else "final" | |
| cache_dir = variant_cache_dir() / variant | |
| os.makedirs(cache_dir, exist_ok=True) | |
| dest = cache_dir / f"{step}.pt" | |
| if dest.exists(): | |
| return dest | |
| md_endpoint = os.getenv("MOONDREAM_ENDPOINT", "https://api.moondream.ai") | |
| headers = {"User-Agent": "moondream-torch"} | |
| api_key = os.getenv("MOONDREAM_API_KEY") | |
| if api_key is not None: | |
| headers["X-Moondream-Auth"] = api_key | |
| req = Request(f"{md_endpoint}/v1/variants/{variant_id}/download", headers=headers) | |
| with urlopen(req) as r, open(dest, "wb") as f: | |
| shutil.copyfileobj(r, f) | |
| return dest | |
| def nest(flat): | |
| tree = {} | |
| for k, v in flat.items(): | |
| parts = k.split(".") | |
| d = tree | |
| for p in parts[:-1]: | |
| d = d.setdefault(p, {}) | |
| d[parts[-1]] = v | |
| return tree | |
| def variant_state_dict(variant_id: Optional[str] = None, device: str = "cpu"): | |
| if variant_id is None: | |
| return None | |
| state_dict = torch.load( | |
| cached_variant_path(variant_id), map_location=device, weights_only=True | |
| ) | |
| # TODO: Move these into the training code that saves checkpoints... | |
| rename_rules = [ | |
| ("text_model.transformer.h", "text.blocks"), | |
| (".mixer", ".attn"), | |
| (".out_proj", ".proj"), | |
| (".Wqkv", ".qkv"), | |
| (".parametrizations.weight.0", ""), | |
| ] | |
| new_state_dict = {} | |
| for key, tensor in state_dict.items(): | |
| new_key = key | |
| for old, new in rename_rules: | |
| if old in new_key: | |
| new_key = new_key.replace(old, new) | |
| new_state_dict[new_key] = tensor | |
| return nest(new_state_dict) | |