TheLastBen
commited on
Commit
•
8ab58cb
1
Parent(s):
2aa3c54
Update mainpaperspacev2.py
Browse files- mainpaperspacev2.py +27 -32
mainpaperspacev2.py
CHANGED
@@ -696,7 +696,7 @@ def dbtrainv2(Resume_Training, UNet_Training_Steps, UNet_Learning_Rate, Text_Enc
|
|
696 |
return resumev2
|
697 |
|
698 |
|
699 |
-
def
|
700 |
|
701 |
|
702 |
if Previous_Session_Name!="":
|
@@ -727,39 +727,38 @@ def testv2(Custom_Path, Previous_Session_Name, Session_Name, Model_Version, User
|
|
727 |
while not os.path.exists(path_to_trained_model):
|
728 |
print("[1;31mThere is no trained model in this session")
|
729 |
time.sleep(5)
|
730 |
-
|
731 |
-
|
732 |
auth=f"--gradio-auth {User}:{Password}"
|
733 |
if User =="" or Password=="":
|
734 |
auth=""
|
735 |
|
736 |
os.chdir('/notebooks')
|
737 |
-
if not os.path.exists('
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
|
|
|
|
743 |
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
call('git clone -q --depth 1 --branch master https://github.com/crowsonkb/k-diffusion', shell=True)
|
751 |
-
|
752 |
|
753 |
if not os.path.exists('/usr/lib/node_modules/localtunnel'):
|
754 |
call('npm install -g localtunnel --silent', shell=True, stdout=open('/dev/null', 'w'))
|
755 |
|
756 |
share=''
|
|
|
|
|
757 |
if not Use_localtunnel:
|
758 |
-
share='--share'
|
759 |
-
call('wget -q -O /usr/local/lib/python3.9/dist-packages/gradio/blocks.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/Dreambooth/blocks.py', shell=True)
|
760 |
|
761 |
else:
|
762 |
-
|
763 |
share=''
|
764 |
os.chdir('/notebooks')
|
765 |
call('nohup lt --port 7860 > srv.txt 2>&1 &', shell=True)
|
@@ -784,21 +783,17 @@ def testv2(Custom_Path, Previous_Session_Name, Session_Name, Model_Version, User
|
|
784 |
call('rm /notebooks/srv.txt', shell=True)
|
785 |
call('rm /notebooks/srvr.txt', shell=True)
|
786 |
|
787 |
-
|
788 |
|
789 |
-
os.chdir('/notebooks/
|
790 |
-
|
791 |
-
call('
|
|
|
792 |
clear_output()
|
793 |
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
configf="--config /notebooks/sd_db/stablediffusion/configs/stable-diffusion/v2-inference.yaml --no-half"
|
798 |
-
else:
|
799 |
-
configf="--config /notebooks/sd_db/stablediffusion/configs/stable-diffusion/v2-inference-v.yaml --no-half"
|
800 |
-
|
801 |
-
return path_to_trained_model, configf, auth
|
802 |
|
803 |
|
804 |
|
|
|
696 |
return resumev2
|
697 |
|
698 |
|
699 |
+
def test(Custom_Path, Previous_Session_Name, Session_Name, User, Password, Use_localtunnel):
|
700 |
|
701 |
|
702 |
if Previous_Session_Name!="":
|
|
|
727 |
while not os.path.exists(path_to_trained_model):
|
728 |
print("[1;31mThere is no trained model in this session")
|
729 |
time.sleep(5)
|
730 |
+
|
|
|
731 |
auth=f"--gradio-auth {User}:{Password}"
|
732 |
if User =="" or Password=="":
|
733 |
auth=""
|
734 |
|
735 |
os.chdir('/notebooks')
|
736 |
+
if not os.path.exists('/notebooks/sd/stablediffusion'):
|
737 |
+
call('wget -q -O sd_kg.tar.zst https://huggingface.co/TheLastBen/dependencies/resolve/main/sd_kg.tar.zst', shell=True)
|
738 |
+
call('tar --zstd -xf sd_kg.tar.zst', shell=True)
|
739 |
+
call('rm sd_kg.tar.zst', shell=True)
|
740 |
+
|
741 |
+
os.chdir('/notebooks/sd')
|
742 |
+
if not os.path.exists('stable-diffusion-webui'):
|
743 |
+
call('git clone -q --depth 1 --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui', shell=True)
|
744 |
|
745 |
+
os.chdir('/notebooks/sd/stable-diffusion-webui/')
|
746 |
+
call('git reset --hard', shell=True, stdout=open('/dev/null', 'w'))
|
747 |
+
print('[1;32m')
|
748 |
+
call('git pull', shell=True, stdout=open('/dev/null', 'w'))
|
749 |
+
os.chdir('/notebooks')
|
750 |
+
clear_output()
|
|
|
|
|
751 |
|
752 |
if not os.path.exists('/usr/lib/node_modules/localtunnel'):
|
753 |
call('npm install -g localtunnel --silent', shell=True, stdout=open('/dev/null', 'w'))
|
754 |
|
755 |
share=''
|
756 |
+
call('wget -q -O /usr/local/lib/python3.9/dist-packages/gradio/blocks.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/blocks.py', shell=True)
|
757 |
+
|
758 |
if not Use_localtunnel:
|
759 |
+
share='--share'
|
|
|
760 |
|
761 |
else:
|
|
|
762 |
share=''
|
763 |
os.chdir('/notebooks')
|
764 |
call('nohup lt --port 7860 > srv.txt 2>&1 &', shell=True)
|
|
|
783 |
call('rm /notebooks/srv.txt', shell=True)
|
784 |
call('rm /notebooks/srvr.txt', shell=True)
|
785 |
|
786 |
+
|
787 |
|
788 |
+
os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
|
789 |
+
call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
|
790 |
+
call("sed -i 's@/content/gdrive/MyDrive/sd/stablediffusion@/notebooks/sd/stablediffusion@' /notebooks/sd/stable-diffusion-webui/modules/paths.py", shell=True)
|
791 |
+
os.chdir('/notebooks/sd/stable-diffusion-webui')
|
792 |
clear_output()
|
793 |
|
794 |
+
configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --xformers --medvram --skip-version-check --ckpt "+path_to_trained_model+" "+auth+" "+share
|
795 |
+
|
796 |
+
return configf
|
|
|
|
|
|
|
|
|
|
|
797 |
|
798 |
|
799 |
|