Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -474,7 +474,7 @@ samplers_diffusers = [
|
|
474 |
# ]
|
475 |
|
476 |
start_time = time.time()
|
477 |
-
timeout =
|
478 |
|
479 |
scheduler = DDIMScheduler.from_pretrained(
|
480 |
base_model,
|
@@ -567,14 +567,18 @@ current_model = base_name
|
|
567 |
def setup_controlnet(name_control,device):
|
568 |
global controlnet_type,controlnetmodel_cache
|
569 |
if name_control not in controlnetmodel_cache:
|
570 |
-
model_control = ControlNetModel.from_pretrained(name_control,
|
|
|
|
|
571 |
controlnetmodel_cache[name_control] = model_control
|
572 |
return controlnetmodel_cache[name_control]
|
573 |
|
574 |
def setup_adapter(adapter_sp,device):
|
575 |
global model_ip_adapter_type,adapter_cache
|
576 |
if adapter_sp not in adapter_cache:
|
577 |
-
model_control = T2IAdapter.from_pretrained(adapter_sp,
|
|
|
|
|
578 |
adapter_cache[adapter_sp] = model_control
|
579 |
return adapter_cache[adapter_sp]
|
580 |
|
@@ -582,16 +586,26 @@ def setup_vae(model,vae_used = "Default"):
|
|
582 |
global vae_link,vae_single_file
|
583 |
vae_model = None
|
584 |
if vae_used == "Default":
|
585 |
-
vae_model = AutoencoderKL.from_pretrained(model,subfolder="vae",
|
|
|
|
|
586 |
elif vae_used == "Consistency Decoder":
|
587 |
-
vae_model = ConsistencyDecoderVAE.from_pretrained(vae_link[vae_used],
|
|
|
|
|
588 |
else:
|
589 |
if vae_single_file[vae_used]:
|
590 |
-
vae_model = AutoencoderKL.from_single_file(vae_link[vae_used],
|
|
|
|
|
591 |
else:
|
592 |
-
vae_model = AutoencoderKL.from_pretrained(vae_link[vae_used],
|
|
|
|
|
593 |
if vae_model is None:
|
594 |
-
vae_model = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse",
|
|
|
|
|
595 |
return vae_model
|
596 |
|
597 |
|
|
|
474 |
# ]
|
475 |
|
476 |
start_time = time.time()
|
477 |
+
timeout = 1800
|
478 |
|
479 |
scheduler = DDIMScheduler.from_pretrained(
|
480 |
base_model,
|
|
|
567 |
def setup_controlnet(name_control,device):
|
568 |
global controlnet_type,controlnetmodel_cache
|
569 |
if name_control not in controlnetmodel_cache:
|
570 |
+
model_control = ControlNetModel.from_pretrained(name_control,
|
571 |
+
#torch_dtype=torch.float16
|
572 |
+
).to(device)
|
573 |
controlnetmodel_cache[name_control] = model_control
|
574 |
return controlnetmodel_cache[name_control]
|
575 |
|
576 |
def setup_adapter(adapter_sp,device):
|
577 |
global model_ip_adapter_type,adapter_cache
|
578 |
if adapter_sp not in adapter_cache:
|
579 |
+
model_control = T2IAdapter.from_pretrained(adapter_sp,
|
580 |
+
#torch_dtype=torch.float16
|
581 |
+
).to(device)
|
582 |
adapter_cache[adapter_sp] = model_control
|
583 |
return adapter_cache[adapter_sp]
|
584 |
|
|
|
586 |
global vae_link,vae_single_file
|
587 |
vae_model = None
|
588 |
if vae_used == "Default":
|
589 |
+
vae_model = AutoencoderKL.from_pretrained(model,subfolder="vae",
|
590 |
+
#torch_dtype=torch.float16
|
591 |
+
)
|
592 |
elif vae_used == "Consistency Decoder":
|
593 |
+
vae_model = ConsistencyDecoderVAE.from_pretrained(vae_link[vae_used],
|
594 |
+
#torch_dtype=torch.float16
|
595 |
+
)
|
596 |
else:
|
597 |
if vae_single_file[vae_used]:
|
598 |
+
vae_model = AutoencoderKL.from_single_file(vae_link[vae_used],
|
599 |
+
#torch_dtype=torch.float16
|
600 |
+
)
|
601 |
else:
|
602 |
+
vae_model = AutoencoderKL.from_pretrained(vae_link[vae_used],
|
603 |
+
#torch_dtype=torch.float16
|
604 |
+
)
|
605 |
if vae_model is None:
|
606 |
+
vae_model = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse",
|
607 |
+
#torch_dtype=torch.float16
|
608 |
+
)
|
609 |
return vae_model
|
610 |
|
611 |
|