Spaces:
Build error
Build error
JiayiGuo821
commited on
Commit
·
d3b542f
1
Parent(s):
06a6c1e
Add files
Browse files
app.py
CHANGED
@@ -252,7 +252,7 @@ def t2i_core(model, xt, emb, nemb, step=30, cfg_scale=7.5, return_list=False):
|
|
252 |
########
|
253 |
|
254 |
class wrapper(object):
|
255 |
-
|
256 |
def __init__(self,
|
257 |
fp16=False,
|
258 |
tag_diffuser=None,
|
@@ -277,13 +277,13 @@ class wrapper(object):
|
|
277 |
self.cache_inverse_folder = "temp/inverse"
|
278 |
self.cache_inverse_maxn = 500
|
279 |
|
280 |
-
|
281 |
def load_all(self, tag_diffuser, tag_lora, tag_scheduler):
|
282 |
self.load_diffuser_lora(tag_diffuser, tag_lora)
|
283 |
self.load_scheduler(tag_scheduler)
|
284 |
return tag_diffuser, tag_lora, tag_scheduler
|
285 |
|
286 |
-
|
287 |
def load_diffuser_lora(self, tag_diffuser, tag_lora):
|
288 |
self.net = StableDiffusionPipeline.from_pretrained(
|
289 |
choices.diffuser[tag_diffuser], torch_dtype=self.torch_dtype).to(self.device)
|
@@ -295,7 +295,7 @@ class wrapper(object):
|
|
295 |
self.tag_lora = tag_lora
|
296 |
return tag_diffuser, tag_lora
|
297 |
|
298 |
-
|
299 |
def load_scheduler(self, tag_scheduler):
|
300 |
self.net.scheduler = choices.scheduler[tag_scheduler].from_config(self.net.scheduler.config)
|
301 |
self.tag_scheduler = tag_scheduler
|
@@ -313,7 +313,7 @@ class wrapper(object):
|
|
313 |
##########
|
314 |
# helper #
|
315 |
##########
|
316 |
-
|
317 |
def precheck_model(self, tag_diffuser, tag_lora, tag_scheduler):
|
318 |
if (tag_diffuser != self.tag_diffuser) or (tag_lora != self.tag_lora):
|
319 |
self.load_all(tag_diffuser, tag_lora, tag_scheduler)
|
@@ -952,7 +952,7 @@ if __name__ == '__main__':
|
|
952 |
css = css_version_4_11_0
|
953 |
|
954 |
wrapper_obj = wrapper(
|
955 |
-
fp16=
|
956 |
tag_diffuser=default.diffuser,
|
957 |
tag_lora=default.lora,
|
958 |
tag_scheduler=default.scheduler)
|
|
|
252 |
########
|
253 |
|
254 |
class wrapper(object):
|
255 |
+
|
256 |
def __init__(self,
|
257 |
fp16=False,
|
258 |
tag_diffuser=None,
|
|
|
277 |
self.cache_inverse_folder = "temp/inverse"
|
278 |
self.cache_inverse_maxn = 500
|
279 |
|
280 |
+
|
281 |
def load_all(self, tag_diffuser, tag_lora, tag_scheduler):
|
282 |
self.load_diffuser_lora(tag_diffuser, tag_lora)
|
283 |
self.load_scheduler(tag_scheduler)
|
284 |
return tag_diffuser, tag_lora, tag_scheduler
|
285 |
|
286 |
+
|
287 |
def load_diffuser_lora(self, tag_diffuser, tag_lora):
|
288 |
self.net = StableDiffusionPipeline.from_pretrained(
|
289 |
choices.diffuser[tag_diffuser], torch_dtype=self.torch_dtype).to(self.device)
|
|
|
295 |
self.tag_lora = tag_lora
|
296 |
return tag_diffuser, tag_lora
|
297 |
|
298 |
+
|
299 |
def load_scheduler(self, tag_scheduler):
|
300 |
self.net.scheduler = choices.scheduler[tag_scheduler].from_config(self.net.scheduler.config)
|
301 |
self.tag_scheduler = tag_scheduler
|
|
|
313 |
##########
|
314 |
# helper #
|
315 |
##########
|
316 |
+
|
317 |
def precheck_model(self, tag_diffuser, tag_lora, tag_scheduler):
|
318 |
if (tag_diffuser != self.tag_diffuser) or (tag_lora != self.tag_lora):
|
319 |
self.load_all(tag_diffuser, tag_lora, tag_scheduler)
|
|
|
952 |
css = css_version_4_11_0
|
953 |
|
954 |
wrapper_obj = wrapper(
|
955 |
+
fp16=False,
|
956 |
tag_diffuser=default.diffuser,
|
957 |
tag_lora=default.lora,
|
958 |
tag_scheduler=default.scheduler)
|