Repository navigation
Expand file tree
/
Copy pathsetup_from_clone.sh
More file actions
executable file
·93 lines (80 loc) · 2.79 KB
/
Copy pathsetup_from_clone.sh
File metadata and controls
executable file
·93 lines (80 loc) · 2.79 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
#!/usr/bin/env bash
# Bootstrap PhonePaint on a fresh machine after `git clone`.
#
# ./setup_from_clone.sh # PhonePaint env + VoiceCraft EnCodec
# ./setup_from_clone.sh --mfa # also mfa_env sidecar (needed for --mfa)
# ./setup_from_clone.sh --mfa --crisper
# ./setup_from_clone.sh --skip-voicecraft
#
# System packages this script cannot install for you (must exist beforehand):
# - conda / mamba (Miniconda or Miniforge)
# - CUDA 12.x driver (for GPU Torch builds in environment.yml)
#
# PhonePaint model checkpoints (.pt) are not downloaded here; pass --checkpoint
# when running the pipeline. ffmpeg/sox come from the conda env.
# EnCodec weights: ./tools/setup_voicecraft.sh (unless --skip-voicecraft).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
WITH_LEGACY_MFA=0
WITH_CRISPER=0
SKIP_VOICECRAFT=0
usage() {
cat <<'EOF'
Bootstrap PhonePaint on a fresh machine after `git clone`.
./setup_from_clone.sh # PhonePaint (Whisper+MAPS+PP) + EnCodec
./setup_from_clone.sh --mfa [--crisper] # also mfa_env sidecar for --mfa
./setup_from_clone.sh --skip-voicecraft
System packages this script cannot install for you (must exist beforehand):
- conda / mamba (Miniconda or Miniforge)
- CUDA 12.x driver
PhonePaint model checkpoints (.pt) are not downloaded here.
EOF
exit "${1:-0}"
}
while [[ $# -gt 0 ]]; do
case "$1" in
--mfa) WITH_LEGACY_MFA=1; shift ;;
--crisper) WITH_CRISPER=1; WITH_LEGACY_MFA=1; shift ;;
--skip-voicecraft) SKIP_VOICECRAFT=1; shift ;;
-h|--help) usage 0 ;;
*) echo "Unknown option: $1" >&2; usage 1 ;;
esac
done
need_cmd() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "ERROR: required command not found: $1" >&2
echo "See preamble of setup_from_clone.sh for system prerequisites." >&2
exit 1
fi
}
echo "== Checking system prerequisites =="
need_cmd conda
need_cmd git
echo " conda=$(command -v conda)"
echo ""
echo "== Creating/updating PhonePaint =="
bash "$ROOT/create_phonepaint_env.sh"
if [[ "$WITH_LEGACY_MFA" -eq 1 ]]; then
echo ""
echo "== MFA sidecar env(s) for --mfa =="
mfa_args=()
if [[ "$WITH_CRISPER" -eq 1 ]]; then
mfa_args+=(--crisper)
else
mfa_args+=(--no-crisper)
fi
bash "$ROOT/create_mfa_envs.sh" "${mfa_args[@]}"
fi
if [[ "$SKIP_VOICECRAFT" -eq 0 ]]; then
echo ""
echo "== VoiceCraft EnCodec (third_party/VoiceCraft) =="
bash "$ROOT/tools/setup_voicecraft.sh"
export VOICECRAFT_ROOT="${VOICECRAFT_ROOT:-$ROOT/third_party/VoiceCraft}"
fi
echo ""
echo "Code-ready. Next:"
echo " conda activate PhonePaint"
echo " export VOICECRAFT_ROOT=${VOICECRAFT_ROOT:-$ROOT/third_party/VoiceCraft}"
echo " python inpaint_pipeline.py --mfa --input … --output … --checkpoint …"
echo " # or: python inpaint_pipeline.py --maps ..."