-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·105 lines (88 loc) · 2.8 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·105 lines (88 loc) · 2.8 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
#!/bin/bash
# Video-DPO Setup Script
# This script sets up the environment for Video-DPO training
set -e # Exit on error
echo "=============================================="
echo "Video-DPO Setup Script"
echo "=============================================="
echo ""
# Check Python version
PYTHON_VERSION=$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d'.' -f1,2)
echo "Python version: $PYTHON_VERSION"
if [[ $(echo "$PYTHON_VERSION < 3.9" | bc -l) -eq 1 ]]; then
echo "ERROR: Python 3.9+ is required"
exit 1
fi
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo ""
echo "Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo ""
echo "Upgrading pip..."
pip install --upgrade pip
# Install PyTorch (detect platform)
echo ""
echo "Installing PyTorch..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS - use MPS
echo "Detected macOS - installing PyTorch with MPS support"
pip install torch torchvision torchaudio
elif command -v nvidia-smi &> /dev/null; then
# NVIDIA GPU available
echo "Detected NVIDIA GPU - installing PyTorch with CUDA support"
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
else
# CPU only
echo "No GPU detected - installing CPU-only PyTorch"
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
fi
# Install requirements
echo ""
echo "Installing requirements..."
pip install -r requirements.txt
# Install package in editable mode
echo ""
echo "Installing video-dpo package..."
pip install -e .
# Verify installation
echo ""
echo "Verifying installation..."
python -c "
import torch
print(f'PyTorch: {torch.__version__}')
print(f'CUDA available: {torch.cuda.is_available()}')
print(f'MPS available: {torch.backends.mps.is_available()}')
import diffusers
print(f'Diffusers: {diffusers.__version__}')
import transformers
print(f'Transformers: {transformers.__version__}')
import accelerate
print(f'Accelerate: {accelerate.__version__}')
import peft
print(f'PEFT: {peft.__version__}')
from src.model import VideoDPOModelWrapper
from src.trainer import DPOTrainer
from src.dataset import VideoDPODataset
print('')
print('All imports successful!')
"
echo ""
echo "=============================================="
echo "Setup Complete!"
echo "=============================================="
echo ""
echo "Next steps:"
echo " 1. Activate the virtual environment: source venv/bin/activate"
echo " 2. Generate training data: make data"
echo " 3. Start training: make train"
echo " 4. Run inference: make inference"
echo ""
echo "For a quick test with fewer samples, edit configs/train_config.yaml"
echo "and reduce num_pairs to 10-20 first."
echo ""