Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save l1na-forever/bb2b495b664c10ed4b2882afd4543eb6 to your computer and use it in GitHub Desktop.
Save l1na-forever/bb2b495b664c10ed4b2882afd4543eb6 to your computer and use it in GitHub Desktop.
From 979077105706b7120ea80feb474667d67c481a9e Mon Sep 17 00:00:00 2001
From: Lina <61861965+l1na-forever@users.noreply.github.com>
Date: Sun, 18 Sep 2022 20:54:38 -0700
Subject: [PATCH] minor tweaks, install AMD ROCM PyTorch 5.1.1
---
entrypoint.sh | 8 +++++++-
scripts/relauncher.py | 4 ++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/entrypoint.sh b/entrypoint.sh
index e130ea0..225440c 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -5,7 +5,7 @@
# set -x
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+SCRIPT_DIR=/sd
cd $SCRIPT_DIR
export PYTHONPATH=$SCRIPT_DIR
@@ -58,6 +58,11 @@ fi
conda activate $ENV_NAME
conda info | grep active
+# Patch for AMD
+echo "Installing PyTorch ROCM5.1.1 version.."
+pip3 install --upgrade torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1
+echo "Done installing PyTorch ROCM"
+
# Function to checks for valid hash for model files and download/replaces if invalid or does not exist
validateDownloadModel() {
local file=$1
@@ -69,6 +74,7 @@ validateDownloadModel() {
sha256sum --check --status <<< "${hash} ${MODEL_DIR}/${file}.${hash}"
if [[ $? == "1" ]]; then
echo "Downloading: ${url} please wait..."
+ mkdir -p ${MODEL_DIR}
mkdir -p ${path}
wget --output-document=${MODEL_DIR}/${file}.${hash} --no-verbose --show-progress --progress=dot:giga ${url}
ln -sf ${MODEL_DIR}/${file}.${hash} ${path}/${file}
diff --git a/scripts/relauncher.py b/scripts/relauncher.py
index 457d539..d59ee77 100644
--- a/scripts/relauncher.py
+++ b/scripts/relauncher.py
@@ -11,10 +11,10 @@ extra_models_cpu = False
open_in_browser = False
# Run Stable Diffusion in Optimized Mode - Only requires 4Gb of VRAM, but is significantly slower
-optimized = False
+optimized = True
# Run in Optimized Turbo Mode - Needs more VRAM than regular optimized mode, but is faster
-optimized_turbo = False
+optimized_turbo = True
# Creates a public xxxxx.gradio.app share link to allow others to use your interface (requires properly forwarded ports to work correctly)
share = False
--
2.37.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment