primal-sage commited on
Commit
a60c6f8
·
verified ·
1 Parent(s): 9ec2c53

Upload code/setup.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. code/setup.sh +101 -0
code/setup.sh ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # ============================================================
3
+ # EMOLIPS - Emotion-Driven Lip-Sync Setup Script
4
+ # Run on RunPod / any Ubuntu GPU instance
5
+ # Usage: bash setup.sh
6
+ # ============================================================
7
+
8
+ set -e
9
+ echo "=========================================="
10
+ echo " EMOLIPS Setup - Emotion Lip-Sync MVP"
11
+ echo "=========================================="
12
+
13
+ # 1. System deps
14
+ echo "[1/6] Installing system dependencies..."
15
+ apt-get update -qq && apt-get install -y -qq ffmpeg libsndfile1 > /dev/null 2>&1
16
+ echo " ✓ System deps installed"
17
+
18
+ # 2. Python deps
19
+ echo "[2/6] Installing Python packages..."
20
+ pip install -q torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 2>/dev/null || true
21
+ pip install -q \
22
+ transformers \
23
+ librosa \
24
+ soundfile \
25
+ opencv-python-headless \
26
+ mediapipe \
27
+ numpy \
28
+ scipy \
29
+ pillow \
30
+ tqdm \
31
+ gdown \
32
+ pyyaml \
33
+ imageio \
34
+ imageio-ffmpeg \
35
+ scikit-image \
36
+ kornia \
37
+ face-alignment \
38
+ dlib \
39
+ gradio \
40
+ einops \
41
+ safetensors \
42
+ accelerate \
43
+ yacs \
44
+ pydub \
45
+ resampy
46
+ echo " ✓ Python packages installed"
47
+
48
+ # 3. Clone SadTalker
49
+ echo "[3/6] Cloning SadTalker backbone..."
50
+ if [ ! -d "SadTalker" ]; then
51
+ git clone --depth 1 https://github.com/OpenTalker/SadTalker.git
52
+ cd SadTalker
53
+ pip install -q -r requirements.txt 2>/dev/null || true
54
+ cd ..
55
+ fi
56
+ echo " ✓ SadTalker cloned"
57
+
58
+ # 4. Download SadTalker pretrained weights
59
+ echo "[4/6] Downloading SadTalker checkpoints..."
60
+ cd SadTalker
61
+ if [ ! -d "checkpoints" ]; then
62
+ mkdir -p checkpoints
63
+ # SadTalker checkpoint download
64
+ bash scripts/download_models.sh 2>/dev/null || {
65
+ echo " ⚠ Auto-download failed. Trying gdown..."
66
+ mkdir -p checkpoints
67
+ # Manual download links (these are the key weights)
68
+ gdown --fuzzy "https://drive.google.com/uc?id=1gwJEawt0Q_7kJXFnhVYQklsb4HGDSM0D" -O checkpoints/ 2>/dev/null || true
69
+ echo " ⚠ If checkpoints missing, download manually from SadTalker GitHub releases"
70
+ }
71
+ fi
72
+ cd ..
73
+ echo " ✓ Checkpoints ready (verify manually if needed)"
74
+
75
+ # 5. Download emotion recognition model (will auto-download on first run via HuggingFace)
76
+ echo "[5/6] Pre-caching emotion recognition model..."
77
+ python3 -c "
78
+ from transformers import pipeline
79
+ print(' Downloading emotion recognition model...')
80
+ classifier = pipeline('audio-classification', model='ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition', device=-1)
81
+ print(' ✓ Emotion model cached')
82
+ " 2>/dev/null || echo " ⚠ Emotion model will download on first inference run"
83
+
84
+ # 6. Setup project structure
85
+ echo "[6/6] Setting up EMOLIPS project structure..."
86
+ mkdir -p outputs samples results
87
+
88
+ echo ""
89
+ echo "=========================================="
90
+ echo " SETUP COMPLETE!"
91
+ echo "=========================================="
92
+ echo ""
93
+ echo "Quick test:"
94
+ echo " python inference.py --audio sample.wav --image face.jpg"
95
+ echo ""
96
+ echo "With emotion override:"
97
+ echo " python inference.py --audio sample.wav --image face.jpg --emotion happy --intensity 0.8"
98
+ echo ""
99
+ echo "Run all emotions:"
100
+ echo " python inference.py --audio sample.wav --image face.jpg --all-emotions"
101
+ echo ""