Skip to content

Commit

Permalink
Merge pull request #1070 from bmaltais/dev2
Browse files Browse the repository at this point in the history
Runpod setup
  • Loading branch information
bmaltais committed Jun 25, 2023
2 parents fbb8d19 + b0988a4 commit 8a3f7f4
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 239 deletions.
31 changes: 26 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
# Python
venv
__pycache__
cudnn_windows
.vscode
*.egg-info
build
wd14_tagger_model

# IDE and Editor specific
.vscode

# CUDNN for Windows
cudnn_windows

# Cache and temporary files
.cache
.DS_Store

# Scripts and executables
locon
gui-user.bat
gui-user.ps1
.vscode

# Version control
SmilingWolf
wandb

# Setup and logs
setup.log
logs
SmilingWolf

# Miscellaneous
uninstall.txt

# Test files
test/output
test/logs
test/*.json
test/ft

# Temporary requirements
requirements_tmp_for_setup.txt
0.13.3

# Version specific
0.13.3
22 changes: 22 additions & 0 deletions config_files/accelerate/runpod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
command_file: null
commands: null
compute_environment: LOCAL_MACHINE
deepspeed_config: {}
distributed_type: 'NO'
downcast_bf16: 'no'
dynamo_backend: 'NO'
fsdp_config: {}
gpu_ids: all
machine_rank: 0
main_process_ip: null
main_process_port: null
main_training_function: main
megatron_lm_config: {}
mixed_precision: 'no'
num_machines: 1
num_processes: 1
rdzv_backend: static
same_network: true
tpu_name: null
tpu_zone: null
use_cpu: false
7 changes: 5 additions & 2 deletions gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
# Step into GUI local directory
cd "$SCRIPT_DIR" || exit 1

if [ "$RUNPOD" = false ]; then
# Activate the virtual environment
if [ -d "$SCRIPT_DIR/venv" ]; then
source "$SCRIPT_DIR/venv/bin/activate" || exit 1
else
echo "venv folder does not exist. Not activating..."
fi

# Check if LD_LIBRARY_PATH environment variable exists
Expand All @@ -45,6 +46,8 @@ if [[ -z "${LD_LIBRARY_PATH}" ]]; then
echo -e "${YELLOW}Certain functionalities may not work correctly.${RESET}"
echo -e "${YELLOW}Please ensure that the required libraries are properly configured.${RESET}"
echo -e " "
echo -e "${YELLOW}If you use WSL2 you may want to: export LD_LIBRARY_PATH=/usr/lib/wsl/lib/${RESET}"
echo -e " "
fi

# Determine the requirements file based on the system
Expand Down
2 changes: 1 addition & 1 deletion requirements_runpod.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
torch==2.0.1+cu117 torchvision==0.15.2+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 # no_verify leave this to specify not checking this a verification stage
torch==2.0.1+cu118 torchvision==0.15.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 # no_verify leave this to specify not checking this a verification stage
xformers==0.0.20 bitsandbytes==0.39.1
accelerate==0.15.0 tensorboard==2.12.1 tensorflow==2.12.0
tensorrt
Expand Down
28 changes: 28 additions & 0 deletions setup-runpod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# This gets the directory the script is run from so pathing can work relative to the script where needed.
SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)"

# Install tk and python3.10-venv
echo "Installing tk and python3.10-venv..."
apt update -y && apt install -y python3-tk python3.10-venv

# Check if the venv folder doesn't exist
if [ ! -d "$SCRIPT_DIR/venv" ]; then
echo "Creating venv..."
python3 -m venv "$SCRIPT_DIR/venv"
fi

# Activate the virtual environment
echo "Activating venv..."
source "$SCRIPT_DIR/venv/bin/activate" || exit 1

# Run setup_linux.py script with platform requirements
echo "Running setup_linux.py..."
python "$SCRIPT_DIR/setup/setup_linux.py" --platform-requirements-file=requirements_runpod.txt

# Configure accelerate
echo "Configuring accelerate..."
mkdir -p "/root/.cache/huggingface/accelerate"
cp "$SCRIPT_DIR/config_files/accelerate/runpod.yaml" "/root/.cache/huggingface/accelerate/default_config.yaml"
# echo "To manually configure accelerate run: $SCRIPT_DIR/venv/bin/activate"
Loading

0 comments on commit 8a3f7f4

Please sign in to comment.