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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
###############################################################################
|
| 3 |
+
# AUTO SETUP: 4K Image Model Training Pipeline
|
| 4 |
+
# Chạy trên VPS mới (Azure, 2x/8x H100) để restore và resume toàn bộ pipeline.
|
| 5 |
+
#
|
| 6 |
+
# Usage:
|
| 7 |
+
# bash autosetup.sh <hf_token>
|
| 8 |
+
#
|
| 9 |
+
# Ví dụ:
|
| 10 |
+
# bash autosetup.sh hf_xxxxxxxxxxxxxxxxxxxx
|
| 11 |
+
###############################################################################
|
| 12 |
+
|
| 13 |
+
set -e
|
| 14 |
+
|
| 15 |
+
HF_TOKEN=${1:-""}
|
| 16 |
+
PROJECT_DIR="/home/adminuser/chungcat"
|
| 17 |
+
DATA0="/data0"
|
| 18 |
+
DATA1="/data1"
|
| 19 |
+
|
| 20 |
+
RED='\033[0;31m'
|
| 21 |
+
GREEN='\033[0;32m'
|
| 22 |
+
YELLOW='\033[1;33m'
|
| 23 |
+
NC='\033[0m'
|
| 24 |
+
|
| 25 |
+
log() { echo -e "${GREEN}[$(date '+%H:%M:%S')]${NC} $1"; }
|
| 26 |
+
warn() { echo -e "${YELLOW}[$(date '+%H:%M:%S')] WARNING:${NC} $1"; }
|
| 27 |
+
err() { echo -e "${RED}[$(date '+%H:%M:%S')] ERROR:${NC} $1"; exit 1; }
|
| 28 |
+
|
| 29 |
+
###############################################################################
|
| 30 |
+
# 1. CHECK ARGS
|
| 31 |
+
###############################################################################
|
| 32 |
+
if [ -z "$HF_TOKEN" ]; then
|
| 33 |
+
err "Usage: bash autosetup.sh <hf_token>"
|
| 34 |
+
fi
|
| 35 |
+
|
| 36 |
+
log "=== 4K Image Model - Full Auto Setup ==="
|
| 37 |
+
log "Project dir: $PROJECT_DIR"
|
| 38 |
+
|
| 39 |
+
###############################################################################
|
| 40 |
+
# 2. FORMAT & MOUNT NVMe DISKS
|
| 41 |
+
###############################################################################
|
| 42 |
+
log "[1/9] Setting up NVMe storage..."
|
| 43 |
+
|
| 44 |
+
setup_nvme() {
|
| 45 |
+
local dev=$1
|
| 46 |
+
local mount=$2
|
| 47 |
+
local label=$3
|
| 48 |
+
|
| 49 |
+
if mountpoint -q "$mount" 2>/dev/null; then
|
| 50 |
+
log " $mount already mounted"
|
| 51 |
+
return
|
| 52 |
+
fi
|
| 53 |
+
|
| 54 |
+
if [ -b "$dev" ]; then
|
| 55 |
+
# Check if already has filesystem
|
| 56 |
+
if ! blkid "$dev" | grep -q ext4; then
|
| 57 |
+
log " Formatting $dev..."
|
| 58 |
+
sudo mkfs.ext4 -L "$label" "$dev"
|
| 59 |
+
fi
|
| 60 |
+
sudo mkdir -p "$mount"
|
| 61 |
+
sudo mount "$dev" "$mount"
|
| 62 |
+
sudo chown adminuser:adminuser "$mount"
|
| 63 |
+
log " Mounted $dev → $mount"
|
| 64 |
+
else
|
| 65 |
+
warn " $dev not found, skipping"
|
| 66 |
+
fi
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
setup_nvme /dev/nvme0n1 "$DATA0" "data0"
|
| 70 |
+
setup_nvme /dev/nvme1n1 "$DATA1" "data1"
|
| 71 |
+
|
| 72 |
+
# Also check /dev/sdb
|
| 73 |
+
if [ -b /dev/sdb1 ] && ! mountpoint -q /mnt 2>/dev/null; then
|
| 74 |
+
sudo mount /dev/sdb1 /mnt 2>/dev/null || true
|
| 75 |
+
fi
|
| 76 |
+
|
| 77 |
+
df -h "$DATA0" "$DATA1" 2>/dev/null || true
|
| 78 |
+
|
| 79 |
+
###############################################################################
|
| 80 |
+
# 3. CREATE PROJECT STRUCTURE
|
| 81 |
+
###############################################################################
|
| 82 |
+
log "[2/9] Creating project structure..."
|
| 83 |
+
|
| 84 |
+
mkdir -p "$PROJECT_DIR"/{scripts/{data_collection,training,serving},configs,logs}
|
| 85 |
+
mkdir -p "$DATA0"/{datasets/{raw,processed},checkpoints,models}
|
| 86 |
+
mkdir -p "$DATA1"/{outputs,logs}
|
| 87 |
+
|
| 88 |
+
# Symlinks
|
| 89 |
+
ln -sf "$DATA0/datasets/processed" "$PROJECT_DIR/data/processed" 2>/dev/null || true
|
| 90 |
+
ln -sf "$DATA0/datasets/raw" "$PROJECT_DIR/data/raw" 2>/dev/null || true
|
| 91 |
+
ln -sf "$DATA0/checkpoints" "$PROJECT_DIR/checkpoints" 2>/dev/null || true
|
| 92 |
+
ln -sf "$DATA1/outputs" "$PROJECT_DIR/outputs" 2>/dev/null || true
|
| 93 |
+
|
| 94 |
+
mkdir -p "$PROJECT_DIR/data" 2>/dev/null || true
|
| 95 |
+
ln -sf "$DATA0/datasets/processed" "$PROJECT_DIR/data/processed"
|
| 96 |
+
ln -sf "$DATA0/datasets/raw" "$PROJECT_DIR/data/raw"
|
| 97 |
+
ln -sf "$DATA0/checkpoints" "$PROJECT_DIR/checkpoints"
|
| 98 |
+
ln -sf "$DATA1/outputs" "$PROJECT_DIR/outputs"
|
| 99 |
+
|
| 100 |
+
###############################################################################
|
| 101 |
+
# 4. INSTALL DEPENDENCIES
|
| 102 |
+
###############################################################################
|
| 103 |
+
log "[3/9] Installing Python dependencies..."
|
| 104 |
+
|
| 105 |
+
pip3 install --upgrade pip -q 2>/dev/null
|
| 106 |
+
|
| 107 |
+
pip3 install -q \
|
| 108 |
+
torch torchvision torchaudio \
|
| 109 |
+
diffusers transformers accelerate deepspeed \
|
| 110 |
+
bitsandbytes peft datasets webdataset img2dataset \
|
| 111 |
+
wandb safetensors xformers \
|
| 112 |
+
opencv-python-headless tqdm anthropic \
|
| 113 |
+
huggingface_hub fastapi uvicorn \
|
| 114 |
+
pandas pyarrow 2>&1 | tail -3
|
| 115 |
+
|
| 116 |
+
log " Dependencies installed"
|
| 117 |
+
|
| 118 |
+
###############################################################################
|
| 119 |
+
# 5. VERIFY GPU
|
| 120 |
+
###############################################################################
|
| 121 |
+
log "[4/9] Verifying GPU..."
|
| 122 |
+
|
| 123 |
+
python3 -c "
|
| 124 |
+
import torch
|
| 125 |
+
gpus = torch.cuda.device_count()
|
| 126 |
+
print(f' PyTorch {torch.__version__} | CUDA {torch.version.cuda} | {gpus} GPUs')
|
| 127 |
+
for i in range(gpus):
|
| 128 |
+
name = torch.cuda.get_device_name(i)
|
| 129 |
+
mem = torch.cuda.get_device_properties(i).total_memory / 1024**3
|
| 130 |
+
print(f' GPU {i}: {name} ({mem:.0f}GB)')
|
| 131 |
+
if gpus == 0:
|
| 132 |
+
print(' WARNING: No GPU detected!')
|
| 133 |
+
"
|
| 134 |
+
|
| 135 |
+
###############################################################################
|
| 136 |
+
# 6. LOGIN HUGGINGFACE
|
| 137 |
+
###############################################################################
|
| 138 |
+
log "[5/9] Logging into HuggingFace..."
|
| 139 |
+
|
| 140 |
+
hf auth login --token "$HF_TOKEN" 2>/dev/null || \
|
| 141 |
+
python3 -c "from huggingface_hub import login; login(token='$HF_TOKEN')"
|
| 142 |
+
|
| 143 |
+
HF_USER=$(python3 -c "from huggingface_hub import HfApi; print(HfApi().whoami()['name'])")
|
| 144 |
+
log " Logged in as: $HF_USER"
|
| 145 |
+
|
| 146 |
+
###############################################################################
|
| 147 |
+
# 7. RESTORE FROM HUGGINGFACE
|
| 148 |
+
###############################################################################
|
| 149 |
+
log "[6/9] Restoring from HuggingFace backup..."
|
| 150 |
+
|
| 151 |
+
python3 -c "
|
| 152 |
+
from huggingface_hub import snapshot_download, HfApi
|
| 153 |
+
import os
|
| 154 |
+
|
| 155 |
+
user = '$HF_USER'
|
| 156 |
+
project = '$PROJECT_DIR'
|
| 157 |
+
|
| 158 |
+
repos = {
|
| 159 |
+
'scripts': f'{user}/4k-image-model-scripts',
|
| 160 |
+
'data': f'{user}/4k-image-model-data',
|
| 161 |
+
'checkpoints': f'{user}/4k-image-model-checkpoints',
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
api = HfApi()
|
| 165 |
+
|
| 166 |
+
# Restore scripts
|
| 167 |
+
try:
|
| 168 |
+
print(' Restoring scripts...')
|
| 169 |
+
snapshot_download(repo_id=repos['scripts'], repo_type='dataset', local_dir=project)
|
| 170 |
+
print(' OK')
|
| 171 |
+
except Exception as e:
|
| 172 |
+
print(f' Skip: {e}')
|
| 173 |
+
|
| 174 |
+
# Restore data metadata
|
| 175 |
+
try:
|
| 176 |
+
print(' Restoring data metadata...')
|
| 177 |
+
snapshot_download(repo_id=repos['data'], repo_type='dataset', local_dir=project)
|
| 178 |
+
print(' OK')
|
| 179 |
+
except Exception as e:
|
| 180 |
+
print(f' Skip: {e}')
|
| 181 |
+
|
| 182 |
+
# Restore checkpoints
|
| 183 |
+
try:
|
| 184 |
+
print(' Restoring checkpoints...')
|
| 185 |
+
snapshot_download(repo_id=repos['checkpoints'], repo_type='model', local_dir='$DATA0/checkpoints')
|
| 186 |
+
print(' OK')
|
| 187 |
+
except Exception as e:
|
| 188 |
+
print(f' Skip: {e}')
|
| 189 |
+
|
| 190 |
+
print(' Restore complete!')
|
| 191 |
+
"
|
| 192 |
+
|
| 193 |
+
###############################################################################
|
| 194 |
+
# 8. DOWNLOAD DATA (if not already present)
|
| 195 |
+
###############################################################################
|
| 196 |
+
log "[7/9] Checking/downloading training data..."
|
| 197 |
+
|
| 198 |
+
# Download COYO metadata if not present
|
| 199 |
+
if [ ! -d "$DATA0/datasets/raw/coyo/data" ]; then
|
| 200 |
+
log " Downloading COYO metadata..."
|
| 201 |
+
python3 -c "
|
| 202 |
+
from huggingface_hub import snapshot_download
|
| 203 |
+
snapshot_download(
|
| 204 |
+
repo_id='kakaobrain/coyo-700m',
|
| 205 |
+
repo_type='dataset',
|
| 206 |
+
local_dir='$DATA0/datasets/raw/coyo',
|
| 207 |
+
allow_patterns=['data/part-00000-*.parquet', 'data/part-00001-*.parquet', 'data/part-00002-*.parquet'],
|
| 208 |
+
max_workers=8,
|
| 209 |
+
)
|
| 210 |
+
print(' COYO metadata downloaded')
|
| 211 |
+
" 2>&1 | tail -3
|
| 212 |
+
else
|
| 213 |
+
log " COYO metadata already present"
|
| 214 |
+
fi
|
| 215 |
+
|
| 216 |
+
# Filter COYO if not done
|
| 217 |
+
if [ ! -f "$DATA0/datasets/raw/coyo_filtered/coyo_aesthetic.parquet" ]; then
|
| 218 |
+
log " Filtering COYO dataset..."
|
| 219 |
+
mkdir -p "$DATA0/datasets/raw/coyo_filtered"
|
| 220 |
+
# Copy filter script output location
|
| 221 |
+
python3 "$PROJECT_DIR/scripts/data_collection/filter_coyo.py" \
|
| 222 |
+
--input-dir "$DATA0/datasets/raw/coyo/data" \
|
| 223 |
+
--output-dir "$DATA0/datasets/raw/coyo_filtered" \
|
| 224 |
+
--min-aesthetic 5.0 --min-clip 0.2 --max-watermark 0.8 --max-records 1000000 2>&1 | tail -3
|
| 225 |
+
else
|
| 226 |
+
log " Filtered data already present"
|
| 227 |
+
fi
|
| 228 |
+
|
| 229 |
+
# Download images if shards don't exist
|
| 230 |
+
SHARD_DIR="$DATA0/datasets/processed/flux_train/shards"
|
| 231 |
+
if [ ! -d "$SHARD_DIR" ] || [ $(ls "$SHARD_DIR"/*.tar 2>/dev/null | wc -l) -lt 10 ]; then
|
| 232 |
+
log " Downloading training images (background)..."
|
| 233 |
+
mkdir -p "$SHARD_DIR"
|
| 234 |
+
python3 -c "
|
| 235 |
+
import pandas as pd
|
| 236 |
+
df = pd.read_parquet('$DATA0/datasets/raw/coyo_filtered/coyo_aesthetic.parquet')
|
| 237 |
+
df_out = df[['url', 'text']].rename(columns={'url': 'URL', 'text': 'TEXT'})
|
| 238 |
+
df_out.to_parquet('$SHARD_DIR/_urls.parquet', index=False)
|
| 239 |
+
print(f' Prepared {len(df_out)} URLs')
|
| 240 |
+
"
|
| 241 |
+
nohup img2dataset \
|
| 242 |
+
--url_list "$SHARD_DIR/_urls.parquet" \
|
| 243 |
+
--input_format parquet \
|
| 244 |
+
--url_col URL \
|
| 245 |
+
--caption_col TEXT \
|
| 246 |
+
--output_format webdataset \
|
| 247 |
+
--output_folder "$SHARD_DIR" \
|
| 248 |
+
--processes_count 1 \
|
| 249 |
+
--thread_count 128 \
|
| 250 |
+
--image_size 1024 \
|
| 251 |
+
--resize_mode center_crop \
|
| 252 |
+
--resize_only_if_bigger True \
|
| 253 |
+
--number_sample_per_shard 1000 \
|
| 254 |
+
--retries 2 \
|
| 255 |
+
> "$DATA1/logs/download_aesthetic.log" 2>&1 &
|
| 256 |
+
log " Image download started (PID: $!)"
|
| 257 |
+
else
|
| 258 |
+
log " Training images already present ($(ls $SHARD_DIR/*.tar 2>/dev/null | wc -l) shards)"
|
| 259 |
+
fi
|
| 260 |
+
|
| 261 |
+
# Download 4K images
|
| 262 |
+
SR_DIR="$DATA0/datasets/processed/sr_4k/shards"
|
| 263 |
+
if [ ! -d "$SR_DIR" ] || [ $(ls "$SR_DIR"/*.tar 2>/dev/null | wc -l) -lt 5 ]; then
|
| 264 |
+
log " Downloading 4K images (background)..."
|
| 265 |
+
mkdir -p "$SR_DIR"
|
| 266 |
+
if [ -f "$DATA0/datasets/raw/coyo_filtered/coyo_4k.parquet" ]; then
|
| 267 |
+
python3 -c "
|
| 268 |
+
import pandas as pd
|
| 269 |
+
df = pd.read_parquet('$DATA0/datasets/raw/coyo_filtered/coyo_4k.parquet')
|
| 270 |
+
df_out = df[['url', 'text']].rename(columns={'url': 'URL', 'text': 'TEXT'})
|
| 271 |
+
df_out.to_parquet('$SR_DIR/_urls.parquet', index=False)
|
| 272 |
+
print(f' Prepared {len(df_out)} 4K URLs')
|
| 273 |
+
"
|
| 274 |
+
nohup img2dataset \
|
| 275 |
+
--url_list "$SR_DIR/_urls.parquet" \
|
| 276 |
+
--input_format parquet \
|
| 277 |
+
--url_col URL \
|
| 278 |
+
--caption_col TEXT \
|
| 279 |
+
--output_format webdataset \
|
| 280 |
+
--output_folder "$SR_DIR" \
|
| 281 |
+
--processes_count 1 \
|
| 282 |
+
--thread_count 128 \
|
| 283 |
+
--image_size 4096 \
|
| 284 |
+
--resize_mode keep_ratio \
|
| 285 |
+
--resize_only_if_bigger True \
|
| 286 |
+
--number_sample_per_shard 100 \
|
| 287 |
+
--retries 2 \
|
| 288 |
+
> "$DATA1/logs/download_4k.log" 2>&1 &
|
| 289 |
+
log " 4K download started (PID: $!)"
|
| 290 |
+
fi
|
| 291 |
+
else
|
| 292 |
+
log " 4K images already present ($(ls $SR_DIR/*.tar 2>/dev/null | wc -l) shards)"
|
| 293 |
+
fi
|
| 294 |
+
|
| 295 |
+
###############################################################################
|
| 296 |
+
# 9. DOWNLOAD FLUX MODEL (if not cached)
|
| 297 |
+
###############################################################################
|
| 298 |
+
log "[8/9] Checking Flux model..."
|
| 299 |
+
|
| 300 |
+
python3 -c "
|
| 301 |
+
from huggingface_hub import snapshot_download
|
| 302 |
+
import os
|
| 303 |
+
cache_dir = '$DATA0/models'
|
| 304 |
+
model_dir = os.path.join(cache_dir, 'models--black-forest-labs--FLUX.1-schnell')
|
| 305 |
+
if os.path.exists(model_dir):
|
| 306 |
+
print(' Flux Schnell already cached')
|
| 307 |
+
else:
|
| 308 |
+
print(' Downloading Flux Schnell...')
|
| 309 |
+
snapshot_download(
|
| 310 |
+
repo_id='black-forest-labs/FLUX.1-schnell',
|
| 311 |
+
cache_dir=cache_dir,
|
| 312 |
+
)
|
| 313 |
+
print(' Flux Schnell downloaded')
|
| 314 |
+
" 2>&1 | tail -3
|
| 315 |
+
|
| 316 |
+
###############################################################################
|
| 317 |
+
# 10. START AUTO-BACKUP
|
| 318 |
+
###############################################################################
|
| 319 |
+
log "[9/9] Starting auto-backup..."
|
| 320 |
+
|
| 321 |
+
# Kill existing backup process if any
|
| 322 |
+
pkill -f "backup.py --auto" 2>/dev/null || true
|
| 323 |
+
|
| 324 |
+
nohup python3 "$PROJECT_DIR/scripts/backup.py" --auto --interval 30 --user "$HF_USER" \
|
| 325 |
+
> "$PROJECT_DIR/logs/backup.log" 2>&1 &
|
| 326 |
+
log " Auto-backup started (PID: $!, every 30 min)"
|
| 327 |
+
|
| 328 |
+
###############################################################################
|
| 329 |
+
# DONE
|
| 330 |
+
###############################################################################
|
| 331 |
+
echo ""
|
| 332 |
+
log "=========================================="
|
| 333 |
+
log " SETUP COMPLETE!"
|
| 334 |
+
log "=========================================="
|
| 335 |
+
echo ""
|
| 336 |
+
echo " Storage:"
|
| 337 |
+
df -h "$DATA0" "$DATA1" 2>/dev/null | grep -v Filesystem
|
| 338 |
+
echo ""
|
| 339 |
+
echo " Background jobs:"
|
| 340 |
+
echo " - Image download: check $DATA1/logs/download_aesthetic.log"
|
| 341 |
+
echo " - 4K download: check $DATA1/logs/download_4k.log"
|
| 342 |
+
echo " - Auto-backup: check $PROJECT_DIR/logs/backup.log"
|
| 343 |
+
echo ""
|
| 344 |
+
echo " Next steps:"
|
| 345 |
+
echo " 1. Wait for data download to finish"
|
| 346 |
+
echo " 2. Start training:"
|
| 347 |
+
echo " bash $PROJECT_DIR/scripts/training/run_train_flux.sh"
|
| 348 |
+
echo " 3. Manual backup anytime:"
|
| 349 |
+
echo " python3 $PROJECT_DIR/scripts/backup.py --backup"
|
| 350 |
+
echo ""
|
| 351 |
+
echo " Monitor:"
|
| 352 |
+
echo " - Download progress: du -sh $DATA0/datasets/processed/flux_train/shards/"
|
| 353 |
+
echo " - GPU usage: nvidia-smi"
|
| 354 |
+
echo " - Training logs: tail -f $PROJECT_DIR/logs/"
|
| 355 |
+
echo ""
|