TheLastBen commited on
Commit
a09519a
1 Parent(s): 4471911

Update Scripts/mainpaperspacev1.py

Browse files
Files changed (1) hide show
  1. Scripts/mainpaperspacev1.py +11 -11
Scripts/mainpaperspacev1.py CHANGED
@@ -113,7 +113,7 @@ def downloadmodel_hf(Path_to_HuggingFace):
113
 
114
 
115
 
116
- def downloadmodel_pth(CKPT_Path, safetensors):
117
 
118
  sftnsr=""
119
  if safetensors:
@@ -122,9 +122,9 @@ def downloadmodel_pth(CKPT_Path, safetensors):
122
  import wget
123
  os.chdir('/notebooks')
124
  clear_output()
125
- if os.path.exists(str(CKPT_Path)):
126
  call('wget -q -O config.yaml https://github.com/CompVis/stable-diffusion/raw/main/configs/stable-diffusion/v1-inference.yaml', shell=True)
127
- call('python /diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py --checkpoint_path '+CKPT_Path+' --dump_path /models/stable-diffusion-custom --original_config_file config.yaml '+sftnsr, shell=True)
128
  clear_output()
129
 
130
  call('rm config.yaml', shell=True)
@@ -135,12 +135,12 @@ def downloadmodel_pth(CKPT_Path, safetensors):
135
  print('Conversion error')
136
  time.sleep(5)
137
  else:
138
- while not os.path.exists(str(CKPT_Path)):
139
  print('Wrong path, use the file explorer to copy the path')
140
  time.sleep(5)
141
 
142
 
143
- def downloadmodel_lnk(CKPT_Link, safetensors):
144
 
145
  sftnsr=""
146
  if not safetensors:
@@ -151,7 +151,7 @@ def downloadmodel_lnk(CKPT_Link, safetensors):
151
 
152
  import wget
153
  os.chdir('/notebooks')
154
- call("gdown --fuzzy " +CKPT_Link+ " -O /models/"+modelnm, shell=True)
155
 
156
  if os.path.exists("/models/"+modelnm):
157
  if os.path.getsize("/models/"+modelnm) > 1810671599:
@@ -174,16 +174,16 @@ def downloadmodel_lnk(CKPT_Link, safetensors):
174
  time.sleep(5)
175
 
176
 
177
- def dl(Path_to_HuggingFace, CKPT_Path, CKPT_Link, safetensors):
178
 
179
  if Path_to_HuggingFace != "":
180
  downloadmodel_hf(Path_to_HuggingFace)
181
  MODEL_NAME="/models/stable-diffusion-custom"
182
- elif CKPT_Path !="":
183
- downloadmodel_pth(CKPT_Path, safetensors)
184
  MODEL_NAME="/models/stable-diffusion-custom"
185
- elif CKPT_Link !="":
186
- downloadmodel_lnk(CKPT_Link, safetensors)
187
  MODEL_NAME="/models/stable-diffusion-custom"
188
  else:
189
  MODEL_NAME="/datasets/stable-diffusion-diffusers/stable-diffusion-v1-5"
 
113
 
114
 
115
 
116
+ def downloadmodel_pth(Model_Path, safetensors):
117
 
118
  sftnsr=""
119
  if safetensors:
 
122
  import wget
123
  os.chdir('/notebooks')
124
  clear_output()
125
+ if os.path.exists(str(Model_Path)):
126
  call('wget -q -O config.yaml https://github.com/CompVis/stable-diffusion/raw/main/configs/stable-diffusion/v1-inference.yaml', shell=True)
127
+ call('python /diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py --checkpoint_path '+Model_Path+' --dump_path /models/stable-diffusion-custom --original_config_file config.yaml '+sftnsr, shell=True)
128
  clear_output()
129
 
130
  call('rm config.yaml', shell=True)
 
135
  print('Conversion error')
136
  time.sleep(5)
137
  else:
138
+ while not os.path.exists(str(Model_Path)):
139
  print('Wrong path, use the file explorer to copy the path')
140
  time.sleep(5)
141
 
142
 
143
+ def downloadmodel_lnk(Model_Link, safetensors):
144
 
145
  sftnsr=""
146
  if not safetensors:
 
151
 
152
  import wget
153
  os.chdir('/notebooks')
154
+ call("gdown --fuzzy " +Model_Link+ " -O /models/"+modelnm, shell=True)
155
 
156
  if os.path.exists("/models/"+modelnm):
157
  if os.path.getsize("/models/"+modelnm) > 1810671599:
 
174
  time.sleep(5)
175
 
176
 
177
+ def dl(Path_to_HuggingFace, Model_Path, Model_Link, safetensors):
178
 
179
  if Path_to_HuggingFace != "":
180
  downloadmodel_hf(Path_to_HuggingFace)
181
  MODEL_NAME="/models/stable-diffusion-custom"
182
+ elif Model_Path !="":
183
+ downloadmodel_pth(Model_Path, safetensors)
184
  MODEL_NAME="/models/stable-diffusion-custom"
185
+ elif Model_Link !="":
186
+ downloadmodel_lnk(Model_Link, safetensors)
187
  MODEL_NAME="/models/stable-diffusion-custom"
188
  else:
189
  MODEL_NAME="/datasets/stable-diffusion-diffusers/stable-diffusion-v1-5"