altayavci commited on
Commit
9b42375
1 Parent(s): fd16b25

Update adapter_model.py

Browse files
Files changed (1) hide show
  1. adapter_model.py +10 -6
adapter_model.py CHANGED
@@ -1,6 +1,6 @@
1
  from dotenv import load_dotenv
2
  import os
3
- from diffusers import StableDiffusionInpaintPipelineLegacy,StableDiffusionControlNetPipeline,ControlNetModel, DDIMScheduler,AutoencoderKL
4
  import torch
5
  from ip_adapter import IPAdapter
6
 
@@ -21,9 +21,9 @@ IP_CKPT_PATH = str(os.getenv(
21
  DEVICE = str(os.getenv(
22
  "DEVICE")
23
  )
24
-
25
- from diffusers import ConsistencyDecoderVAE
26
-
27
 
28
 
29
  noise_scheduler = DDIMScheduler(
@@ -35,8 +35,12 @@ noise_scheduler = DDIMScheduler(
35
  set_alpha_to_one=False,
36
  steps_offset=1,
37
  )
38
- vae = AutoencoderKL.from_pretrained(VAE_MODEL_PATH).to(dtype=torch.float16)
39
- vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16)
 
 
 
 
40
 
41
 
42
  class MODEL:
 
1
  from dotenv import load_dotenv
2
  import os
3
+ from diffusers import StableDiffusionInpaintPipelineLegacy, StableDiffusionControlNetPipeline, ControlNetModel, DDIMScheduler, AutoencoderKL, ConsistencyDecoderVAE
4
  import torch
5
  from ip_adapter import IPAdapter
6
 
 
21
  DEVICE = str(os.getenv(
22
  "DEVICE")
23
  )
24
+ OPENAI_CONSISTENCY_VAE = str(os.getenv(
25
+ "OPENAI_CONSISTENCY_VAE")
26
+ )
27
 
28
 
29
  noise_scheduler = DDIMScheduler(
 
35
  set_alpha_to_one=False,
36
  steps_offset=1,
37
  )
38
+
39
+ if OPENAI_CONSISTENCY_VAE == "ENABLE":
40
+ vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16)
41
+
42
+ else :
43
+ vae = AutoencoderKL.from_pretrained(VAE_MODEL_PATH).to(dtype=torch.float16)
44
 
45
 
46
  class MODEL: