Instructions to use nnopt-dev/YOLO11n-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use nnopt-dev/YOLO11n-MLX with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download nnopt-dev/YOLO11n-MLX --local-dir YOLO11n-MLX
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
File size: 1,717 Bytes
56fa795 | 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 | #!/bin/bash
# Install the YOLO11n MLX port into DEST (this Mac is the device): sources, fused weights, a private venv
# installed offline from build/wheels, run.sh and port.json.
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
DEST="${1:?usage: deploy.sh DEST}"
BUILD="$HERE/build"
[ -f "$BUILD/yolo11n_fused.npz" ] || { echo "deploy.sh: run build.sh first" >&2; exit 1; }
mkdir -p "$DEST"
DEST="$(cd "$DEST" && pwd)"
rm -rf "$DEST/app" "$DEST/venv"
mkdir -p "$DEST/app"
cp "$HERE/src/run.py" "$HERE/src/yolo_mlx.py" "$HERE/src/kernels.py" "$DEST/app/"
cp "$BUILD/yolo11n_fused.npz" "$DEST/app/"
if [ -f "$BUILD/libspin.dylib" ]; then cp "$BUILD/libspin.dylib" "$DEST/app/"; fi
# Same interpreter as the build venv; --copies so the venv survives the kit copying DEST elsewhere.
BASE_PY="$("$BUILD/venv/bin/python" -c 'import sys; print(sys._base_executable)')"
"$BASE_PY" -m venv --copies "$DEST/venv"
"$DEST/venv/bin/python" -m pip install -q --disable-pip-version-check --no-index --find-links "$BUILD/wheels" \
mlx==0.32.4 mlx-metal==0.32.4 numpy==2.5.4 opencv-python-headless==5.0.0.93
cat > "$DEST/run.sh" <<'EOF'
# YOLO11n detection on MLX (Apple GPU). Usage: sh ./run.sh --image IN.jpg [--repeat R] --out OUT.json --metrics M.json
HERE="$(cd "$(dirname "$0")" && pwd)"
export PYTHONNOUSERSITE=1
unset PYTHONPATH PYTHONHOME
exec "$HERE/venv/bin/python" -s "$HERE/app/run.py" --weights "$HERE/app/yolo11n_fused.npz" "$@"
EOF
cat > "$DEST/port.json" <<EOF
{"contract": 1, "model_type": "vision_detection", "runtime": "MLX $("$DEST/venv/bin/python" -c 'import mlx.core as mx; print(mx.__version__)') (Metal GPU)", "precision": "fp16", "external_files": []}
EOF
echo "deploy.sh: installed into $DEST"
|