TheLastBen commited on
Commit
2aa3c54
1 Parent(s): 152e69f

Update mainpaperspacev1.py

Browse files
Files changed (1) hide show
  1. mainpaperspacev1.py +24 -21
mainpaperspacev1.py CHANGED
@@ -720,31 +720,32 @@ def test(Custom_Path, Previous_Session_Name, Session_Name, User, Password, Use_l
720
  auth=""
721
 
722
  os.chdir('/notebooks')
723
- if not os.path.exists('sd_db'):
724
- call('mkdir sd_db', shell=True)
725
- os.chdir('/notebooks/sd_db')
726
- call('git clone --depth 1 --branch main https://github.com/Stability-AI/stablediffusion', shell=True)
727
- call('git clone --depth 1 --branch Paperspacedb https://github.com/TheLastBen/stable-diffusion-webui', shell=True)
728
- clear_output()
 
 
729
 
730
- if not os.path.exists('/notebooks/sd_db/stablediffusion/src/k-diffusion/k_diffusion'):
731
- call('mkdir /notebooks/sd_db/stablediffusion/src', shell=True)
732
- os.chdir('/notebooks/sd_db/stablediffusion/src')
733
- call('git clone -q --depth 1 --no-tags https://github.com/TheLastBen/taming-transformers.git', shell=True)
734
- call('git clone -q --depth 1 https://github.com/salesforce/BLIP', shell=True)
735
- call('git clone -q --depth 1 https://github.com/sczhou/CodeFormer', shell=True)
736
- call('git clone -q --depth 1 --branch master https://github.com/crowsonkb/k-diffusion', shell=True)
737
 
738
  if not os.path.exists('/usr/lib/node_modules/localtunnel'):
739
  call('npm install -g localtunnel --silent', shell=True, stdout=open('/dev/null', 'w'))
740
 
741
  share=''
 
 
742
  if not Use_localtunnel:
743
- share='--share'
744
- 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)
745
 
746
  else:
747
-
748
  share=''
749
  os.chdir('/notebooks')
750
  call('nohup lt --port 7860 > srv.txt 2>&1 &', shell=True)
@@ -771,13 +772,15 @@ def test(Custom_Path, Previous_Session_Name, Session_Name, User, Password, Use_l
771
 
772
 
773
 
774
- os.chdir('/notebooks/sd_db/stable-diffusion-webui')
775
- print('')
776
- call('git pull', shell=True)
777
-
778
  clear_output()
 
 
779
 
780
- return path_to_trained_model, auth, share
781
 
782
 
783
 
 
720
  auth=""
721
 
722
  os.chdir('/notebooks')
723
+ if not os.path.exists('/notebooks/sd/stablediffusion'):
724
+ call('wget -q -O sd_kg.tar.zst https://huggingface.co/TheLastBen/dependencies/resolve/main/sd_kg.tar.zst', shell=True)
725
+ call('tar --zstd -xf sd_kg.tar.zst', shell=True)
726
+ call('rm sd_kg.tar.zst', shell=True)
727
+
728
+ os.chdir('/notebooks/sd')
729
+ if not os.path.exists('stable-diffusion-webui'):
730
+ call('git clone -q --depth 1 --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui', shell=True)
731
 
732
+ os.chdir('/notebooks/sd/stable-diffusion-webui/')
733
+ call('git reset --hard', shell=True, stdout=open('/dev/null', 'w'))
734
+ print('')
735
+ call('git pull', shell=True, stdout=open('/dev/null', 'w'))
736
+ os.chdir('/notebooks')
737
+ clear_output()
 
738
 
739
  if not os.path.exists('/usr/lib/node_modules/localtunnel'):
740
  call('npm install -g localtunnel --silent', shell=True, stdout=open('/dev/null', 'w'))
741
 
742
  share=''
743
+ 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)
744
+
745
  if not Use_localtunnel:
746
+ share='--share'
 
747
 
748
  else:
 
749
  share=''
750
  os.chdir('/notebooks')
751
  call('nohup lt --port 7860 > srv.txt 2>&1 &', shell=True)
 
772
 
773
 
774
 
775
+ os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
776
+ call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
777
+ call("sed -i 's@/content/gdrive/MyDrive/sd/stablediffusion@/notebooks/sd/stablediffusion@' /notebooks/sd/stable-diffusion-webui/modules/paths.py", shell=True)
778
+ os.chdir('/notebooks/sd/stable-diffusion-webui')
779
  clear_output()
780
+
781
+ configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --xformers --medvram --skip-version-check --ckpt "+path_to_trained_model+" "+auth+" "+share
782
 
783
+ return configf
784
 
785
 
786