Byte-parity with pyannote-PyTorch reference (cosine 0.763718 identical at 6 decimals on 200 cross-window slot pairs). 2.5x faster than pyannote-MPS on Apple Silicon native. Extracted from gitea.tavportal.com/olivier/MLX_CONVERTOR commit 5f9eafa.
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
INSTALL_DIR="${1:-$HOME/pyannote-diarization-3.1-mlx-test}"
|
|
INSTALL_DIR="${INSTALL_DIR/#\~/$HOME}"
|
|
HTTPS_SPEC="pyannote-speaker-diarization-3.1-mlx @ git+https://gitea.tavportal.com/olivier/pyannote-speaker-diarization-3.1-mlx.git"
|
|
SSH_SPEC="git+ssh://git@gitea.tavportal.com/olivier/pyannote-speaker-diarization-3.1-mlx.git"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage:
|
|
$0 [install-dir]
|
|
|
|
Creates a uv project and installs pyannote-speaker-diarization-3.1-mlx.
|
|
Default install directory:
|
|
$INSTALL_DIR
|
|
EOF
|
|
}
|
|
|
|
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
if ! command -v uv >/dev/null 2>&1; then
|
|
cat >&2 <<'EOF'
|
|
uv is required but was not found.
|
|
|
|
Install it with:
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
|
|
Then restart your shell and run this script again.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$INSTALL_DIR"
|
|
cd "$INSTALL_DIR"
|
|
|
|
if [[ ! -f pyproject.toml ]]; then
|
|
uv init --python 3.12
|
|
else
|
|
echo "Found existing pyproject.toml in $INSTALL_DIR; skipping uv init."
|
|
fi
|
|
|
|
echo "Installing from HTTPS..."
|
|
if ! uv add "$HTTPS_SPEC"; then
|
|
echo "HTTPS install failed; falling back to SSH pip install..."
|
|
uv pip install "$SSH_SPEC"
|
|
fi
|
|
|
|
uv run python -c "from pyannote_diarization_3_1_mlx import MlxDiarizationPipeline; print('OK')"
|