-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_setup.sh
More file actions
executable file
Β·179 lines (153 loc) Β· 5.04 KB
/
Copy pathdocker_setup.sh
File metadata and controls
executable file
Β·179 lines (153 loc) Β· 5.04 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/bin/bash
# Comprehensive Docker Setup Script for HY-Motion
# Handles checkpoint mounting, animation generation, and troubleshooting
echo "π³ HY-Motion Docker Setup Assistant"
echo "=================================="
# Check if Docker is running
if ! docker info >/dev/null 2>&1; then
echo "β Docker is not running. Please start Docker first."
exit 1
fi
echo "β
Docker is running"
# Build the Docker image
build_image() {
echo "π¨ Building HY-Motion Docker image..."
docker build -t hymotion:latest -f Dockerfile .
if [ $? -eq 0 ]; then
echo "β
Docker image built successfully"
else
echo "β Docker build failed"
exit 1
fi
}
# Check if checkpoints exist on host
check_host_checkpoints() {
if [ -d "ckpts/tencent/HY-Motion-1.0" ]; then
if [ -f "ckpts/tencent/HY-Motion-1.0/config.yml" ] && [ -f "ckpts/tencent/HY-Motion-1.0/latest.ckpt" ]; then
echo "β
Host checkpoints found and complete"
return 0
else
echo "β οΈ Host checkpoint directory exists but incomplete"
return 1
fi
else
echo "β No host checkpoints found"
return 1
fi
}
# Download checkpoints if needed
download_checkpoints() {
echo "π₯ Downloading checkpoints..."
make download-t2m
if [ $? -eq 0 ]; then
echo "β
Checkpoints downloaded successfully"
else
echo "β Checkpoint download failed"
return 1
fi
}
# Run streaming app with proper checkpoint mounting
run_streaming() {
echo "π Starting HY-Motion Streaming App..."
# Check for checkpoints
if check_host_checkpoints; then
echo "π Mounting host checkpoints"
VOLUME_ARGS="-v $(pwd)/ckpts:/app/ckpts"
else
echo "β οΈ No host checkpoints found, will use container checkpoints or download"
VOLUME_ARGS=""
fi
# Run the container
docker run -it --rm \\
--gpus all \\
-p 7860:7860 -p 7861:7861 \\
-v $(pwd):/app \\
$VOLUME_ARGS \\
-e PYTHONPATH=/app \\
-e USE_HF_MODELS=0 \\
hymotion:latest \\
python gradio_app_streaming.py
}
# Copy checkpoints to container (alternative approach)
copy_checkpoints_to_container() {
echo "π¦ Copying checkpoints to container..."
# First create a temporary container
CONTAINER_ID=$(docker create hymotion:latest)
# Copy checkpoints
if [ -d "ckpts/tencent/HY-Motion-1.0" ]; then
docker cp ckpts/tencent/HY-Motion-1.0 $CONTAINER_ID:/app/ckpts/tencent/
echo "β
Checkpoints copied to container"
else
echo "β No checkpoints to copy"
docker rm $CONTAINER_ID
return 1
fi
# Commit the container with checkpoints
docker commit $CONTAINER_ID hymotion-with-checkpoints:latest
echo "β
Created image with checkpoints: hymotion-with-checkpoints:latest"
# Clean up
docker rm $CONTAINER_ID
# Run the new image
docker run -it --rm \\
--gpus all \\
-p 7860:7860 -p 7861:7861 \\
-v $(pwd):/app \\
-e PYTHONPATH=/app \\
-e USE_HF_MODELS=0 \\
hymotion-with-checkpoints:latest \\
python gradio_app_streaming.py
}
# Troubleshoot animation issues
troubleshoot_animation() {
echo "π Troubleshooting Animation Issues..."
# Check common issues
echo "Checking common animation issues:"
# 1. Check if FBX module is available
python -c "try: import fbx; print('β
FBX module available')
except ImportError: print('β FBX module missing')"
# 2. Check if body model is available
python -c "from hymotion.pipeline.motion_diffusion import MotionFlowMatching; print('β
Body model available')"
# 3. Check animation generation
echo "Testing animation generation..."
python -c "
from hymotion.utils.t2m_runtime import T2MRuntime
import os
# Test with a simple configuration
try:
runtime = T2MRuntime(
config_path='ckpts/tencent/HY-Motion-1.0/config.yml',
ckpt_name='ckpts/tencent/HY-Motion-1.0/latest.ckpt',
skip_model_loading=True,
disable_prompt_engineering=True
)
print('β
Runtime initialization successful')
except Exception as e:
print(f'β Runtime initialization failed: {e}')
"
}
# Main menu
main_menu() {
echo ""
echo "π― HY-Motion Docker Setup Menu"
echo "1. Build Docker image"
echo "2. Check host checkpoints"
echo "3. Download checkpoints"
echo "4. Run streaming app (recommended)"
echo "5. Copy checkpoints to container"
echo "6. Troubleshoot animation issues"
echo "7. Exit"
echo ""
read -p "Enter your choice (1-7): " choice
case $choice in
1) build_image ;;
2) check_host_checkpoints ;;
3) download_checkpoints ;;
4) run_streaming ;;
5) copy_checkpoints_to_container ;;
6) troubleshoot_animation ;;
7) echo "Goodbye! π"; exit 0 ;;
*) echo "Invalid choice. Please try again."; main_menu ;;
esac
}
# Start with main menu
main_menu