Create start_bash.sh
Browse filesDL models bash dont forget to chmod+x the bash
- start_bash.sh +47 -0
start_bash.sh
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Remove existing virtual environment if it exists
|
4 |
+
if [ -d "venv" ]; then
|
5 |
+
echo "Removing existing virtual environment..."
|
6 |
+
rm -rf venv
|
7 |
+
fi
|
8 |
+
|
9 |
+
# Create and activate a new virtual environment
|
10 |
+
echo "Creating and activating a new virtual environment..."
|
11 |
+
python3 -m venv venv
|
12 |
+
source venv/bin/activate
|
13 |
+
|
14 |
+
# Upgrade pip
|
15 |
+
echo "Upgrading pip..."
|
16 |
+
pip install --upgrade pip
|
17 |
+
|
18 |
+
# Install PyTorch with CUDA support (for NVIDIA RTX 3060 Ti, likely CUDA 11.8)
|
19 |
+
echo "Installing PyTorch with CUDA support..."
|
20 |
+
pip install torch==2.1.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118
|
21 |
+
|
22 |
+
# Install Audiocraft and other dependencies
|
23 |
+
echo "Installing Audiocraft, Gradio, and other dependencies..."
|
24 |
+
pip install audiocraft==1.3.0 gradio==4.44.1 numpy==1.26.4
|
25 |
+
|
26 |
+
# Create the models directory if it doesn't exist
|
27 |
+
echo "Creating models directory for musicgen-medium..."
|
28 |
+
mkdir -p models/musicgen-medium
|
29 |
+
|
30 |
+
# Download the musicgen-medium model using Audiocraft
|
31 |
+
# This will download the model to ~/.cache/audiocraft by default
|
32 |
+
echo "Downloading musicgen-medium model..."
|
33 |
+
python3 -c "from audiocraft.models import MusicGen; MusicGen.get_pretrained('facebook/musicgen-medium')"
|
34 |
+
|
35 |
+
# Move the model to the specified directory
|
36 |
+
# Audiocraft typically downloads models to ~/.cache/audiocraft
|
37 |
+
# We'll move it to /home/ubuntu/ghostai_music_generator/models/musicgen-medium
|
38 |
+
echo "Moving model to /home/ubuntu/ghostai_music_generator/models/musicgen-medium..."
|
39 |
+
mv ~/.cache/audiocraft/models--facebook--musicgen-medium/* models/musicgen-medium/
|
40 |
+
|
41 |
+
# Deactivate the virtual environment
|
42 |
+
echo "Deactivating virtual environment..."
|
43 |
+
deactivate
|
44 |
+
|
45 |
+
echo "Setup complete! You can now activate the virtual environment and run your application:"
|
46 |
+
echo "source venv/bin/activate"
|
47 |
+
echo "python3 app.py"
|