From 6d0fa3358216c1dd142e6986b07a5bd5608da442 Mon Sep 17 00:00:00 2001 From: SayanoAI <28544690+SayanoAI@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:51:55 -0400 Subject: [PATCH] added bash script --- conda-start.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++ conda-uninstall.sh | 13 ++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 conda-start.sh create mode 100644 conda-uninstall.sh diff --git a/conda-start.sh b/conda-start.sh new file mode 100644 index 0000000..93365db --- /dev/null +++ b/conda-start.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Set up environment variables +ENV_NAME=$(basename "$PWD") +INSTALL_DIR="$HOME/Miniconda3" +export PATH="$INSTALL_DIR/condabin:$PATH" +COMFY_MANAGER_DIR="$(dirname "$0")/../ComfyUI-Manager" +COMFYUI_DIR="$(dirname "$0")/../.." + +# Check if conda environment is available and create it if not +if conda info --envs | grep -i "$ENV_NAME"; then + echo "$ENV_NAME environment is already available" +else + echo "$ENV_NAME environment does not exist" + echo "Creating a new environment" + conda create -n "$ENV_NAME" python=3.10 -y +fi + +# Activate environment +source activate "$ENV_NAME" + +if [ $? -eq 0 ]; then + # Install custom node dependencies + pip install -r requirements.txt + + # Install ComfyUI Manager + if [ -d "$COMFY_MANAGER_DIR" ]; then + cd "$COMFY_MANAGER_DIR" + git pull + else + git clone https://github.com/ltdrdata/ComfyUI-Manager "$COMFY_MANAGER_DIR" + pip install -r "$COMFY_MANAGER_DIR/requirements.txt" + fi + + # Change the working directory to the root folder + cd "$COMFYUI_DIR" + + # Install packages + pip install -r requirements.txt + mim install mmengine mmcv>=2.0.1 mmdet>=3.1.0 mmpose>=1.1.0 + + # Install CUDA torch + pip install torch==2.3.1+cu118 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 + + python main.py --preview-method=taesd --force-fp16 --use-pytorch-cross-attention +else + echo "Failed to activate environment..." +fi + +read -p "Press any key to continue..." diff --git a/conda-uninstall.sh b/conda-uninstall.sh new file mode 100644 index 0000000..e6040e8 --- /dev/null +++ b/conda-uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Set up environment variable +ENV_NAME=$(basename "$PWD") + +echo "Are you sure you wish to uninstall $ENV_NAME? Close this window if you clicked this by mistake." +read -p "Press any key to continue..." + +# Remove conda environment +conda remove --name "$ENV_NAME" --all + +echo "Successfully uninstalled the app. Press any key to close." +read -p "" \ No newline at end of file