Create nd_setup.sh
Browse files- nd_setup.sh +42 -0
nd_setup.sh
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Configuration
|
| 4 |
+
install_dir=~/ # Define the installation directory
|
| 5 |
+
do_aws_setup=true # Flag to control AWS setup
|
| 6 |
+
|
| 7 |
+
# Create necessary directories
|
| 8 |
+
mkdir -p "$install_dir/models"
|
| 9 |
+
mkdir -p "$install_dir/datasets"
|
| 10 |
+
|
| 11 |
+
# Clone and set up naifu-diffusion
|
| 12 |
+
cd "$install_dir" || exit
|
| 13 |
+
git clone https://github.com/Mikubill/naifu-diffusion nd && cd nd
|
| 14 |
+
git checkout sgm
|
| 15 |
+
pip install -r requirements.txt xformers prodigyopt
|
| 16 |
+
|
| 17 |
+
# Download parameter calculator
|
| 18 |
+
param_calc="https://huggingface.co/trojblue/nd-param-calculator/resolve/main/nd_param_calculator_latest.ipynb"
|
| 19 |
+
wget "$param_calc"
|
| 20 |
+
|
| 21 |
+
# AWS setup
|
| 22 |
+
if [ "$do_aws_setup" = true ]; then
|
| 23 |
+
echo "Setting up AWS..."
|
| 24 |
+
# Check if aws command exists
|
| 25 |
+
if ! command -v aws &> /dev/null; then
|
| 26 |
+
echo "Installing AWS CLI..."
|
| 27 |
+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
| 28 |
+
sudo apt install unzip && unzip awscliv2.zip
|
| 29 |
+
sudo ./aws/install
|
| 30 |
+
rm awscliv2.zip
|
| 31 |
+
else
|
| 32 |
+
echo "AWS CLI is already installed."
|
| 33 |
+
fi
|
| 34 |
+
|
| 35 |
+
# AWS S3 copy command
|
| 36 |
+
cd "$install_dir/models" || exit
|
| 37 |
+
aws s3 cp s3://bucket-external/trainer_opt/sdxl-fulldan-run-continue/checkpoint/nd-epoch-09.ckpt fd5me9.ckpt
|
| 38 |
+
else
|
| 39 |
+
echo "Skipping AWS setup..."
|
| 40 |
+
fi
|
| 41 |
+
|
| 42 |
+
# Add any additional setup or installation commands below
|