Instructions to use hoopstreet/moondream3-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hoopstreet/moondream3-preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hoopstreet/moondream3-preview", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("hoopstreet/moondream3-preview", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hoopstreet/moondream3-preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hoopstreet/moondream3-preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hoopstreet/moondream3-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hoopstreet/moondream3-preview
- SGLang
How to use hoopstreet/moondream3-preview with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hoopstreet/moondream3-preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hoopstreet/moondream3-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hoopstreet/moondream3-preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hoopstreet/moondream3-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hoopstreet/moondream3-preview with Docker Model Runner:
docker model run hf.co/hoopstreet/moondream3-preview
File size: 1,415 Bytes
1f342ad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import numpy as np
def remove_outlier_points(points_tuples, k_nearest=2, threshold=2.0):
"""
Robust outlier detection for list of (x,y) tuples.
Only requires numpy.
Args:
points_tuples: list of (x,y) tuples
k_nearest: number of neighbors to consider
threshold: multiplier for median distance
Returns:
list: filtered list of (x,y) tuples with outliers removed
list: list of booleans indicating which points were kept (True = kept)
"""
points = np.array(points_tuples)
n_points = len(points)
# Calculate pairwise distances manually
dist_matrix = np.zeros((n_points, n_points))
for i in range(n_points):
for j in range(i + 1, n_points):
# Euclidean distance between points i and j
dist = np.sqrt(np.sum((points[i] - points[j]) ** 2))
dist_matrix[i, j] = dist
dist_matrix[j, i] = dist
# Get k nearest neighbors' distances
k = min(k_nearest, n_points - 1)
neighbor_distances = np.partition(dist_matrix, k, axis=1)[:, :k]
avg_neighbor_dist = np.mean(neighbor_distances, axis=1)
# Calculate mask using median distance
median_dist = np.median(avg_neighbor_dist)
mask = avg_neighbor_dist <= threshold * median_dist
# Return filtered tuples and mask
filtered_tuples = [t for t, m in zip(points_tuples, mask) if m]
return filtered_tuples
|