Viperboy123 commited on
Commit
9d4ad59
·
1 Parent(s): 8dce3e8
Files changed (10) hide show
  1. MyRP.ipynb +175 -0
  2. autoUpload.sh +111 -0
  3. commit.bat +30 -0
  4. e +86 -0
  5. forcePull.bat +11 -0
  6. forcePull_rp.sh +11 -0
  7. gc.sh +28 -0
  8. install_rp.sh +89 -0
  9. out_rp.sh +49 -0
  10. run_rp.sh +19 -0
MyRP.ipynb ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "d6bdd156-e441-4f7b-bd7e-d397fc335428",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "!kill -9 $(ps -ef | grep 'relauncher.py' | grep -v 'grep' | awk '{print $2}')\n",
11
+ "!kill -9 $(ps -ef | grep 'webui' | grep -v 'grep' | awk '{print $2}')\n",
12
+ "!kill -9 $(ps -ef | grep 'launch.py' | grep -v 'grep' | awk '{print $2}')\n",
13
+ "!kill -9 $(ps -ef | grep 'run.sh' | grep -v 'grep' | awk '{print $2}')\n",
14
+ "!kill -9 $(ps -ef | grep 'run.py' | grep -v 'grep' | awk '{print $2}')"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": null,
20
+ "id": "f34d6131-8170-4173-ac5c-f835c9fa6ea5",
21
+ "metadata": {
22
+ "scrolled": true
23
+ },
24
+ "outputs": [],
25
+ "source": [
26
+ "%cd /workspace\n",
27
+ "!sh /workspace/run.sh\n",
28
+ "#final_args = f\"python /workspace/SD/launch.py --port 7860 --api --theme dark --allow-code --enable-insecure-extension-access --listen --share --cuda-malloc --cuda-stream --pin-shared-memory\"\n",
29
+ "#!{final_args}"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "code",
34
+ "execution_count": null,
35
+ "id": "1778d96c-dca4-4d2a-bbe6-3ee6b29fc504",
36
+ "metadata": {},
37
+ "outputs": [],
38
+ "source": []
39
+ },
40
+ {
41
+ "cell_type": "code",
42
+ "execution_count": null,
43
+ "id": "a6dc2425-7df8-4d99-80b3-312bac52019f",
44
+ "metadata": {},
45
+ "outputs": [],
46
+ "source": [
47
+ "!git -C /workspace/SD/models fetch --all\n",
48
+ "!git -C /workspace/SD/models reset --hard origin/main\n",
49
+ "!git -C /workspace/SD/models pull\n",
50
+ "!git -C /workspace/SD/models repack -a -d --depth=250 --window=250\n",
51
+ "!rsync -r \"/workspace/SD/models/embeddings/\" \"/workspace/SD/embeddings/\"\n",
52
+ "!rm -r \"/workspace/SD/models/.git/lfs\""
53
+ ]
54
+ },
55
+ {
56
+ "cell_type": "code",
57
+ "execution_count": null,
58
+ "id": "6d5e74dc-c597-4182-927b-fb506987d7ca",
59
+ "metadata": {},
60
+ "outputs": [],
61
+ "source": [
62
+ "!sh /workspace/out.sh 0"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "id": "23bbfe13-0ac5-4881-848b-a94008e045ff",
69
+ "metadata": {},
70
+ "outputs": [],
71
+ "source": [
72
+ "!curl -L -O https://huggingface.co/zuv0/SDXLRF11001/resolve/main/autoUpload.sh | bash -c 'sleep 1; . ./autoUpload.sh xxxx'"
73
+ ]
74
+ },
75
+ {
76
+ "cell_type": "code",
77
+ "execution_count": null,
78
+ "id": "abb78189-95bc-4d04-b897-b75ffa5ec539",
79
+ "metadata": {},
80
+ "outputs": [],
81
+ "source": [
82
+ "import os\n",
83
+ "if os.path.exists(\"/workspace/SD/output\"):\n",
84
+ " !runpodctl send /workspace/SD/output\n",
85
+ "else:\n",
86
+ " if os.path.exists(\"/workspace/output\"):\n",
87
+ " !runpodctl send /workspace/output"
88
+ ]
89
+ },
90
+ {
91
+ "cell_type": "code",
92
+ "execution_count": null,
93
+ "id": "9ebbbb83-c8ef-47d2-b038-92145196385e",
94
+ "metadata": {},
95
+ "outputs": [],
96
+ "source": []
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": null,
101
+ "id": "94503b7f-e460-4eda-8679-058497ae771a",
102
+ "metadata": {
103
+ "scrolled": true
104
+ },
105
+ "outputs": [],
106
+ "source": [
107
+ "%cd /workspace/SD\n",
108
+ "!curl -L -O https://huggingface.co/zuv0/SDXLF17/resolve/main/downs.sh | bash -c 'sleep 1; . ./downs.sh d3 0'"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "id": "645dbd2b-0f6f-4791-8b30-435649d27ed2",
115
+ "metadata": {},
116
+ "outputs": [],
117
+ "source": [
118
+ "import torch\n",
119
+ "import torchvision\n",
120
+ "print(torch.__version__)\n",
121
+ "print(torchvision.__version__)"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": null,
127
+ "id": "87d3aadd-7a32-4132-a1ec-0d53b75518be",
128
+ "metadata": {},
129
+ "outputs": [],
130
+ "source": []
131
+ },
132
+ {
133
+ "cell_type": "code",
134
+ "execution_count": null,
135
+ "id": "c7f291ff-c792-454e-9a20-211759f9e208",
136
+ "metadata": {},
137
+ "outputs": [],
138
+ "source": []
139
+ },
140
+ {
141
+ "cell_type": "code",
142
+ "execution_count": null,
143
+ "id": "93a28067-28c7-47eb-88ef-cb8864eee7a4",
144
+ "metadata": {},
145
+ "outputs": [],
146
+ "source": []
147
+ }
148
+ ],
149
+ "metadata": {
150
+ "kernelspec": {
151
+ "display_name": "Python 3 (ipykernel)",
152
+ "language": "python",
153
+ "name": "python3"
154
+ },
155
+ "language_info": {
156
+ "codemirror_mode": {
157
+ "name": "ipython",
158
+ "version": 3
159
+ },
160
+ "file_extension": ".py",
161
+ "mimetype": "text/x-python",
162
+ "name": "python",
163
+ "nbconvert_exporter": "python",
164
+ "pygments_lexer": "ipython3",
165
+ "version": "3.10.12"
166
+ },
167
+ "vscode": {
168
+ "interpreter": {
169
+ "hash": "c36c8ff63afb68809d72fa6323bde02fb9b90fe01b492d36c13befd021790766"
170
+ }
171
+ }
172
+ },
173
+ "nbformat": 4,
174
+ "nbformat_minor": 5
175
+ }
autoUpload.sh ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # version 1
4
+
5
+ # output filename add
6
+ FLAG_NAME=$1
7
+
8
+ # null
9
+ FLAG_NULL=$2
10
+
11
+ # flag Key
12
+ FLAG_KEY=$3
13
+
14
+ if [ -z "$FLAG_NAME" ] || [ "$FLAG_NAME" = " " ]; then
15
+ FLAG_NAME="null"
16
+ fi
17
+ if [ -z "$FLAG_NULL" ]; then
18
+ FLAG_NULL="null"
19
+ fi
20
+ if [ -z "$FLAG_KEY" ]; then
21
+ FLAG_KEY="null"
22
+ fi
23
+
24
+ cd /workspace
25
+ cd *
26
+
27
+ R_PATH="$(pwd)"
28
+
29
+ if [ ! -d "$R_PATH/SD" ]; then
30
+ echo "SD folder not found."
31
+ exit 101
32
+ fi
33
+
34
+ MUID=""
35
+
36
+ if [ -f "$R_PATH/SD/MUID.txt" ]; then
37
+ MUID=$(<./SD/MUID.txt)
38
+ MUID=${MUID%%+( )}
39
+ MUID=${MUID%%+(\n)}
40
+ #MUID_LEN=${#MUID}
41
+ #MUID=${MUID:1:MUID_LEN-2}
42
+ else
43
+ RANDOM_STR1="$(head -c 128 /dev/urandom | tr -dc 'A-Z')ZZ"
44
+ RANDOM_STR2="$(head -c 384 /dev/urandom | tr -dc 'A-Z0-9')ZZZZZZZZZZZZZZ"
45
+ MUID="${RANDOM_STR1::1}${RANDOM_STR2::14}${RANDOM_STR1:1:1}"
46
+ echo -e "$MUID" >> ./SD/MUID.txt
47
+ fi
48
+
49
+ if [ ! -f "$R_PATH/SD/autoUpload_Log.txt" ]; then
50
+ touch ./SD/autoUpload_Log.txt
51
+ fi
52
+
53
+ if [ ! -f "$R_PATH/SD/autoUpload_UploadQueueIng.txt" ]; then
54
+ touch ./SD/autoUpload_UploadQueueIng.txt
55
+ fi
56
+
57
+ if [ ! -f "$R_PATH/SD/autoUpload_UploadQueueDone.txt" ]; then
58
+ touch ./SD/autoUpload_UploadQueueDone.txt
59
+ fi
60
+
61
+ OUPUT_PATH=""
62
+
63
+ if [ -d "$R_PATH/output" ]; then
64
+ OUPUT_PATH="output"
65
+ elif [ -d "$R_PATH/SD/output" ]; then
66
+ OUPUT_PATH="SD/output"
67
+ elif [ -d "$R_PATH/CU/output" ]; then
68
+ OUPUT_PATH="CU/output"
69
+ else
70
+ echo "output folder not found."
71
+ exit 102
72
+ fi
73
+
74
+ #echo "$FLAG_NAME $FLAG_NULL $FLAG_KEY $R_PATH $OUPUT_PATH $MUID"
75
+
76
+ if [ "$FLAG_KEY" = "null" ]; then
77
+ # enter when the user runs manually.
78
+ apt-get install -y inotify-tools
79
+ apt-get install -y zip
80
+ pip3 install pcloud
81
+ CURRNET_PID=$$
82
+ #kill -9 $(ps -ef | grep 'autoUpload' | grep -v 'grep' | awk '{print $2}')
83
+ kill -9 $(ps -ef | grep 'autoUpload' | grep -v 'grep' | awk -v pid=$CURRNET_PID '$2 != pid {print $2}')
84
+ FLAG_KEY="startDaemon"
85
+ bash -c ". $R_PATH/autoUpload.sh $FLAG_NAME $FLAG_NULL $FLAG_KEY"
86
+ elif [ "$FLAG_KEY" = "startDaemon" ]; then
87
+ cd /workspace
88
+ cd *
89
+ FLAG_KEY="runningDaemon"
90
+ chmod 755 autoUpload.sh
91
+ nohup ./autoUpload.sh $FLAG_NAME $FLAG_NULL $FLAG_KEY 2>&1 &
92
+ elif [ "$FLAG_KEY" = "runningDaemon" ]; then
93
+ cd /workspace
94
+ cd *
95
+ while :
96
+ do
97
+ bash -c ". $R_PATH/out.sh 1 $FLAG_NAME"
98
+ sleep 288s
99
+ for item in $(find . -name "output_${FLAG_NAME}*.zip"); do
100
+ rm -rf $item
101
+ done
102
+ sleep 10s
103
+ done
104
+ elif [ "$FLAG_KEY" = "clean" ]; then
105
+ rm -rf "$R_PATH/SD/autoUpload_UploadQueueIng.txt"
106
+ rm -rf "$R_PATH/SD/autoUpload_UploadQueueDone.txt"
107
+ elif [ "$FLAG_KEY" = "kill" ]; then
108
+ kill -15 $(ps -ef | grep 'autoUpload.sh' | grep -v 'grep' | awk '{print $2}')
109
+ else
110
+ :
111
+ fi
commit.bat ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ git config user.name "anonymous"
4
+ git config user.email my@gmail.com
5
+
6
+ set /P comment=Comment?
7
+
8
+ if not "%comment%" == "" goto :next
9
+ set comment=auto
10
+ :next
11
+
12
+ git reset
13
+
14
+ ::git add *.* --force
15
+ ::git add *
16
+ git add --all
17
+
18
+ echo ----- git add done ------
19
+
20
+ git status
21
+
22
+ echo ready. press any key to commit START.
23
+ ::timeout /t 1
24
+ pause
25
+
26
+ git commit -m "%comment%"
27
+
28
+ git push -u origin main
29
+
30
+ pause
e ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ FLAG_1=$1
4
+ FLAG_2=$2
5
+ FLAG_3=$3
6
+ R_PATH="$(pwd)"
7
+ CURRENT_DATE=$(date +"%Y%m%d_%H%M%S")
8
+ MUID=""
9
+ OUPUT_PATH=""
10
+
11
+ if [ -d "$R_PATH/output" ]; then
12
+ OUPUT_PATH="output"
13
+ elif [ -d "$R_PATH/outputs" ]; then
14
+ OUPUT_PATH="outputs"
15
+ elif [ -d "$R_PATH/SD/output" ]; then
16
+ OUPUT_PATH="SD/output"
17
+ elif [ -d "$R_PATH/SD/outputs" ]; then
18
+ OUPUT_PATH="SD/outputs"
19
+ else
20
+ OUPUT_PATH="SD/output"
21
+ fi
22
+
23
+ if [ -f "$R_PATH/SD/MUID.txt" ]; then
24
+ MUID=$(<./SD/MUID.txt)
25
+ MUID=${MUID%%+( )}
26
+ MUID=${MUID%%+(\n)}
27
+ #MUID_LEN=${#MUID}
28
+ #MUID=${MUID:1:MUID_LEN-2}
29
+ else
30
+ RANDOM_STR1="$(head -c 128 /dev/urandom | tr -dc 'A-Z')ZZ"
31
+ RANDOM_STR2="$(head -c 384 /dev/urandom | tr -dc 'A-Z0-9')ZZZZZZZZZZZZZZ"
32
+ MUID="${RANDOM_STR1::1}${RANDOM_STR2::14}${RANDOM_STR1:1:1}"
33
+ echo -e "$MUID" >> ./SD/MUID.txt
34
+ fi
35
+
36
+ MUIDL="${MUID::3}${MUID:13:3}"
37
+
38
+ if [[ "$FLAG_1" =~ h ]]; then
39
+ echo -e " k : kill launch.sh(webui)\n @ : outputs/t2i folder to rename\n u : autoUpload MUID3+3\n f : forcePull\n o : out.sh\n g : gc.sh\n e : current chackpoint del\n d 0~9 : chackpoint download\n r : run.sh\n example : . e kdr 4"
40
+ else
41
+ if [[ "$FLAG_1" =~ k ]]; then
42
+ kill -9 $(ps -ef | grep 'webui' | grep -v 'grep' | awk '{print $2}')
43
+ kill -9 $(ps -ef | grep 'launch.py' | grep -v 'grep' | awk '{print $2}')
44
+ kill -9 $(ps -ef | grep 'run.sh' | grep -v 'grep' | awk '{print $2}')
45
+ fi
46
+
47
+ if [[ "$FLAG_1" =~ @ ]]; then
48
+ if [ -d "$R_PATH/$OUPUT_PATH/txt2img-images" ]; then
49
+ RANDOM_STR="$(head -c 128 /dev/urandom | tr -dc 'A-Z')ZZZ"
50
+ RENAME_NAME="t2i_${RANDOM_STR::4}${CURRENT_DATE}"
51
+ \mv -f "$R_PATH/$OUPUT_PATH/txt2img-images" "$R_PATH/$OUPUT_PATH/${RENAME_NAME}"
52
+ echo -e "rename txt2img-images -> ${RENAME_NAME}"
53
+ fi
54
+ fi
55
+
56
+ if [[ "$FLAG_1" =~ u ]]; then
57
+ curl -L -O https://huggingface.co/zuv0/SDXLRF115T/resolve/main/autoUpload.sh
58
+ sleep 1
59
+ bash -c ". ./autoUpload.sh $MUIDL"
60
+ fi
61
+
62
+ if [[ "$FLAG_1" =~ f ]]; then
63
+ bash -c ". $R_PATH/forcePull.sh"
64
+ fi
65
+
66
+ if [[ "$FLAG_1" =~ o ]]; then
67
+ bash -c ". $R_PATH/out.sh"
68
+ fi
69
+
70
+ if [[ "$FLAG_1" =~ g ]]; then
71
+ bash -c ". $R_PATH/gc.sh"
72
+ fi
73
+
74
+ if [[ "$FLAG_1" =~ e ]]; then
75
+ bash -c ". $R_PATH/SD/downs.sh gc"
76
+ fi
77
+
78
+ if [[ "$FLAG_1" =~ d ]]; then
79
+ bash -c ". $R_PATH/SD/downs.sh $FLAG_2 0"
80
+ fi
81
+
82
+ if [[ "$FLAG_1" =~ r ]]; then
83
+ bash -c ". $R_PATH/run.sh"
84
+ fi
85
+
86
+ fi
forcePull.bat ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ git fetch --all
4
+ git reset --hard origin/main
5
+ git pull
6
+ git repack -a -d --depth=250 --window=250
7
+ cd .git
8
+ rmdir /S /Q lfs
9
+ cd ..
10
+
11
+ pause
forcePull_rp.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd /workspace
4
+ git -C /workspace/SD/models fetch --all
5
+ git -C /workspace/SD/models reset --hard origin/main
6
+ git -C /workspace/SD/models pull
7
+ git -C /workspace/SD/models repack -a -d --depth=250 --window=250
8
+ rsync -r "/workspace/SD/models/embeddings/" "/workspace/SD/embeddings/"
9
+ rm -r "/workspace/SD/models/.git/lfs"
10
+
11
+ cd /workspace
gc.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ FLAG_1=$1
4
+
5
+ cd /workspace
6
+ rm -rf output
7
+ rm -rf outputs
8
+ rm -f out*.tar*
9
+ rm -f out*.zip*
10
+
11
+ cd *
12
+ rm -rf output
13
+ rm -rf outputs
14
+ rm -f out*.tar*
15
+ rm -f out*.zip*
16
+
17
+ cd SD
18
+ rm -rf output
19
+ rm -rf outputs
20
+
21
+ if [ ${FLAG_1} -eq "1" ]; then
22
+ sudo rm -rf /tmp/*
23
+ else
24
+ find /tmp -mtime +2 -delete
25
+ fi
26
+
27
+ cd /workspace
28
+ cd *
install_rp.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd /workspace
4
+ mkdir -p tmp
5
+ rm -rf README.md
6
+ rm -rf s
7
+ rm -rf ss.sh
8
+
9
+ \cp -f /workspace/SD/e /workspace/e
10
+ \cp -f /workspace/SD/run_rp.sh /workspace/run.sh
11
+ \cp -f /workspace/SD/out_rp.sh /workspace/out.sh
12
+ \cp -f /workspace/SD/forcePull_rp.sh /workspace/forcePull.sh
13
+ \cp -f /workspace/SD/gc.sh /workspace/gc.sh
14
+ \cp -f /workspace/SD/MyRP.ipynb /workspace/MyRP.ipynb
15
+
16
+ kill -9 $(ps -ef | grep 'relauncher.py' | grep -v 'grep' | awk '{print $2}')
17
+ kill -9 $(ps -ef | grep 'webui' | grep -v 'grep' | awk '{print $2}')
18
+ kill -9 $(ps -ef | grep 'launch.py' | grep -v 'grep' | awk '{print $2}')
19
+
20
+ rm -rf /workspace/stable-diffusion-webui
21
+
22
+ apt -y update -qq
23
+ apt-get install git-lfs
24
+ apt-get -y install rsync
25
+ apt-get -y install zip
26
+ """
27
+ curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
28
+ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
29
+ """
30
+ git lfs install --force
31
+
32
+ cd /workspace/SD
33
+ curl -L -O https://huggingface.co/zuv0/test/resolve/main/SDXLRF115T.tar
34
+ tar -xf SDXLRF115T.tar
35
+ rm -rf SDXLRF115T.tar
36
+ git clone https://huggingface.co/zuv0/modelsXL models
37
+
38
+ cd /workspace/SD/models
39
+ git fetch --all
40
+ git reset --hard origin/main
41
+ git pull
42
+ rsync -r "embeddings/" "../embeddings/"
43
+ git repack -a -d --depth=250 --window=250
44
+ cd .git
45
+ rm -rf lfs
46
+
47
+ cd /workspace/SD
48
+ curl -L -O https://huggingface.co/zuv0/SDXLF17/resolve/main/downs.sh
49
+ sh downs.sh $1 0
50
+
51
+ pip3 install pcloud
52
+ """
53
+ pip uninstall -y setuptools
54
+ pip install setuptools==69.5.1
55
+ pip uninstall -y matplotlib
56
+ pip install matplotlib==3.8.4
57
+ pip uninstall -y xformers
58
+ pip uninstall -y torchaudio
59
+ pip install torch==2.3.0 torchvision --index-url https://download.pytorch.org/whl/cu121
60
+ pip3 install -r requirements_versions.txt --extra-index-url https://download.pytorch.org/whl/cu121
61
+ pip3 install -r extensions-builtin/sd_forge_controlnet/requirements.txt
62
+ pip3 install -r extensions-builtin/forge_legacy_preprocessors/requirements.txt
63
+ #pip3 install insightface
64
+ pip3 uninstall -y onnxruntime
65
+ pip3 install onnxruntime-gpu
66
+ pip install pydantic==1.10.11
67
+ #apt install libgl1 -yq
68
+ apt-get install -y libgl1-mesa-glx
69
+ #apt -y install -qq aria2 libcairo2-dev pkg-config python3-dev
70
+ """
71
+ #python3 -c "from launch import prepare_environment; prepare_environment()" --skip-torch-cuda-test
72
+
73
+ cd /workspace
74
+
75
+ python3 /workspace/SD/launch.py --no-download-sd-model --exit
76
+
77
+ apt-get clean
78
+ pip cache purge
79
+
80
+ kill -9 $(ps -ef | grep 'relauncher.py' | grep -v 'grep' | awk '{print $2}')
81
+ kill -9 $(ps -ef | grep 'webui' | grep -v 'grep' | awk '{print $2}')
82
+ kill -9 $(ps -ef | grep 'launch.py' | grep -v 'grep' | awk '{print $2}')
83
+
84
+ rm -rf /workspace/stable-diffusion-webui
85
+ cd /workspace
86
+
87
+ echo " -----===== =====----- "
88
+ echo " Install Done."
89
+ echo " -----===== =====----- "
out_rp.sh ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # if == "1" running
4
+ OUT_CLOUD=$1
5
+
6
+ # file add
7
+ NAME=$2
8
+ if [ -z "$NAME" ]; then
9
+ NAME=""
10
+ else
11
+ NAME="${NAME}_"
12
+ fi
13
+
14
+ if command -v zip >/dev/null 2>&1; then
15
+ :
16
+ else
17
+ apt-get install zip -y
18
+ pip install pcloud
19
+ fi
20
+
21
+ CURRENT_DATE=$(date +"%Y%m%d_%H%M%S")
22
+ ZIP_FILENAME="output_${NAME}${CURRENT_DATE}.zip"
23
+ W_PATH="/workspace"
24
+ if [ -d "/workspace/firstContainer" ]; then
25
+ W_PATH="/workspace/firstContainer"
26
+ fi
27
+
28
+ cd "$W_PATH"
29
+
30
+ if [ -d "$W_PATH/SD/output" ]; then
31
+ echo "Creating archive. Please wait..."
32
+ zip -q -r "$W_PATH/$ZIP_FILENAME" "$W_PATH/SD/output"
33
+ echo "archive file : $ZIP_FILENAME"
34
+ fi
35
+
36
+ if [ -d "$W_PATH/output" ]; then
37
+ echo "Creating archive. Please wait..."
38
+ zip -q -r "$W_PATH/$ZIP_FILENAME" "$W_PATH/output"
39
+ echo "archive file : $ZIP_FILENAME"
40
+ fi
41
+
42
+ PD="'$(echo eDg3NjV4eHhAZ21haWwuY29t | base64 --decode)', 'Number'"
43
+
44
+ if [ -f "$W_PATH/$ZIP_FILENAME" ]; then
45
+ export ZIP_FILENAME
46
+ if [ "$OUT_CLOUD" = "1" ]; then
47
+ python3.10 -c "import os; from pcloud import PyCloud; pc = PyCloud($PD); pc.uploadfile(files=['$W_PATH/$ZIP_FILENAME', '$W_PATH/$ZIP_FILENAME'], path='/')"
48
+ fi
49
+ fi
run_rp.sh ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd /workspace
4
+
5
+ # Spot Instance vs
6
+ if dpkg-query -W libgl1 2>/dev/null | grep -q "libgl1"; then
7
+ echo -n ""
8
+ else
9
+ echo "libgl1 is not installed. Installing..."
10
+ apt update
11
+ apt install -yq libgl1
12
+ fi
13
+
14
+ python /workspace/SD/launch.py --port 7860 --api --theme dark --allow-code --enable-insecure-extension-access --listen --share --cuda-malloc --cuda-stream --pin-shared-memory
15
+
16
+ kill $!
17
+ kill -9 $(ps -ef | grep 'ngrok' | grep -v 'grep' | awk '{print $2}')
18
+ deactivate
19
+ echo "stopped"