File size: 4,984 Bytes
a602628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Setup script for ACE-Step Custom Edition
"""

import subprocess
import sys
from pathlib import Path
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


def run_command(cmd, description):
    """Run a shell command and handle errors."""
    logger.info(f"\n{'='*60}")
    logger.info(f"{description}")
    logger.info(f"{'='*60}")
    
    try:
        result = subprocess.run(
            cmd,
            shell=True,
            check=True,
            capture_output=True,
            text=True
        )
        logger.info(result.stdout)
        return True
    except subprocess.CalledProcessError as e:
        logger.error(f"โŒ Error: {e}")
        logger.error(e.stderr)
        return False


def create_directories():
    """Create necessary directories."""
    dirs = [
        "outputs",
        "timelines",
        "lora_training",
        "lora_training/prepared_data",
        "lora_training/models",
        "logs",
        "models"
    ]
    
    logger.info("\n๐Ÿ“ Creating directories...")
    for dir_path in dirs:
        Path(dir_path).mkdir(parents=True, exist_ok=True)
        logger.info(f"  โœ… {dir_path}")


def check_python_version():
    """Check Python version."""
    logger.info("\n๐Ÿ Checking Python version...")
    version = sys.version_info
    logger.info(f"  Python {version.major}.{version.minor}.{version.micro}")
    
    if version.major < 3 or (version.major == 3 and version.minor < 8):
        logger.error("  โŒ Python 3.8+ required")
        return False
    
    logger.info("  โœ… Python version OK")
    return True


def install_requirements():
    """Install Python requirements."""
    logger.info("\n๐Ÿ“ฆ Installing requirements...")
    
    cmd = f"{sys.executable} -m pip install -r requirements.txt"
    return run_command(cmd, "Installing Python packages")


def check_gpu():
    """Check GPU availability."""
    logger.info("\n๐ŸŽฎ Checking GPU...")
    
    try:
        import torch
        
        if torch.cuda.is_available():
            gpu_name = torch.cuda.get_device_name(0)
            gpu_memory = torch.cuda.get_device_properties(0).total_memory / 1e9
            logger.info(f"  โœ… GPU: {gpu_name}")
            logger.info(f"  โœ… VRAM: {gpu_memory:.1f} GB")
            
            if gpu_memory < 8:
                logger.warning("  โš ๏ธ  Low VRAM. Consider using optimizations.")
            
            return True
        else:
            logger.warning("  โš ๏ธ  No GPU detected. Will run on CPU (slower)")
            return False
            
    except ImportError:
        logger.error("  โŒ PyTorch not installed")
        return False


def main():
    """Main setup process."""
    logger.info("""
    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘         ACE-Step 1.5 Custom Edition Setup              โ•‘
    โ•‘                                                          โ•‘
    โ•‘  A comprehensive music generation system with:          โ•‘
    โ•‘  โ€ข Standard ACE-Step interface                          โ•‘
    โ•‘  โ€ข Custom timeline-based workflow                       โ•‘
    โ•‘  โ€ข LoRA training studio                                 โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
    """)
    
    # Check Python version
    if not check_python_version():
        logger.error("\nโŒ Setup failed: Python version too old")
        sys.exit(1)
    
    # Create directories
    create_directories()
    
    # Install requirements
    if not install_requirements():
        logger.error("\nโŒ Setup failed: Could not install requirements")
        sys.exit(1)
    
    # Check GPU
    check_gpu()
    
    # Success message
    logger.info("""
    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘              โœ… Setup Complete!                         โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
    
    Next steps:
    
    1. Download the ACE-Step model:
       python scripts/download_model.py
    
    2. Run the application:
       python app.py
    
    3. Open your browser to:
       http://localhost:7860
    
    For HuggingFace Spaces deployment:
       - Upload all files to your Space
       - Set SDK to 'gradio'
       - Set Python version to 3.10
       - Enable GPU (A10G or better recommended)
    
    For help and documentation:
       - README.md
       - docs/ directory
    """)


if __name__ == "__main__":
    main()