Repository navigation
Expand file tree
/
Copy pathsetup_models.sh
More file actions
executable file
·100 lines (85 loc) · 3.47 KB
/
Copy pathsetup_models.sh
File metadata and controls
executable file
·100 lines (85 loc) · 3.47 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
# Setup script — runs 'uv sync' in each model directory to create isolated venvs.
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
MODELS_DIR="$SCRIPT_DIR/models"
# Detect current platform
case "$(uname -s)" in
Linux*) CURRENT_PLATFORM="linux";;
Darwin*) CURRENT_PLATFORM="macos";;
*) CURRENT_PLATFORM="other";;
esac
echo "============================================"
echo " tts-compare — Setting up model environments"
echo " Platform: $CURRENT_PLATFORM"
echo "============================================"
# System dependency: SoX is required by Qwen3-TTS (qwen-tts uses the sox binary)
if ! command -v sox &>/dev/null; then
echo "[system] Installing SoX (required by Qwen3-TTS)..."
if command -v brew &>/dev/null; then
echo " Detected Homebrew (macOS)"
brew install sox || echo "[warn] Could not install sox — install manually: brew install sox"
elif command -v apt-get &>/dev/null; then
echo " Detected apt (Debian/Ubuntu)"
sudo apt-get install -y sox libsox-fmt-all || echo "[warn] Could not install sox — install manually: sudo apt-get install sox libsox-fmt-all"
else
echo "[warn] Could not detect package manager (brew or apt-get)"
echo " Please install SoX manually for your system:"
echo " - macOS: brew install sox"
echo " - Debian/Ubuntu: sudo apt-get install sox libsox-fmt-all"
echo " - Other systems: check your package manager documentation"
fi
fi
for model_dir in "$MODELS_DIR"/*/; do
model_name="$(basename "$model_dir")"
if [ ! -f "$model_dir/pyproject.toml" ]; then
echo "[skip] $model_name — no pyproject.toml"
continue
fi
# Check platform compatibility from manifest.json
if [ -f "$model_dir/manifest.json" ]; then
platform_check=$(python3 -c "
import json
try:
with open('$model_dir/manifest.json') as f:
manifest = json.load(f)
platforms = manifest.get('platforms', None)
if platforms is None or '$CURRENT_PLATFORM' in platforms:
print('compatible')
else:
print('incompatible:' + ','.join(platforms))
except Exception:
print('compatible') # Default to compatible if we can't parse
")
if [[ "$platform_check" == incompatible:* ]]; then
supported_platforms="${platform_check#incompatible:}"
echo ""
echo "--- $model_name ---"
echo " [skip] requires $supported_platforms (current: $CURRENT_PLATFORM)"
continue
fi
fi
echo ""
echo "--- $model_name ---"
cd "$model_dir"
# Pre-install setuptools for models with no-build-isolation packages
if grep -q 'no-build-isolation-package' pyproject.toml 2>/dev/null; then
echo " (pre-installing build deps for no-build-isolation packages)"
uv venv --quiet 2>/dev/null || true
uv pip install setuptools "numpy<2.0" 2>&1 || true
fi
if uv sync 2>&1; then
echo " ✓ $model_name ready"
# Fish Speech requires .project-root file for pyrootutils
if [ "$model_name" = "fish_speech" ] && [ ! -f .project-root ]; then
echo " (creating .project-root for pyrootutils)"
touch .project-root
fi
else
echo " ✗ $model_name failed (see errors above)"
fi
done
echo ""
echo "============================================"
echo " Setup complete. Run: python main.py"
echo "============================================"