adamelliotfields commited on
Commit
de96e86
·
verified ·
1 Parent(s): 232c234

Logging improvements

Browse files
Files changed (1) hide show
  1. lib/loader.py +6 -1
lib/loader.py CHANGED
@@ -57,22 +57,27 @@ class Loader:
57
  attrs = ["b1", "b2", "s1", "s2"]
58
  has_freeu = all(getattr(block, attr, None) is not None for attr in attrs)
59
  if has_freeu and not freeu:
 
60
  self.pipe.disable_freeu()
61
  elif not has_freeu and freeu:
62
  # https://github.com/ChenyangSi/FreeU
 
63
  self.pipe.enable_freeu(b1=1.5, b2=1.6, s1=0.9, s2=0.2)
64
 
65
  def _load_ip_adapter(self, ip_adapter=None):
66
  if self.ip_adapter is None and self.ip_adapter != ip_adapter:
 
67
  self.pipe.load_ip_adapter(
68
  "h94/IP-Adapter",
69
  subfolder="models",
70
  weight_name=f"ip-adapter-{ip_adapter}_sd15.safetensors",
71
  )
72
- self.pipe.set_ip_adapter_scale(0.6 if ip_adapter == "full-face" else 0.5)
 
73
  self.ip_adapter = ip_adapter
74
 
75
  if self.ip_adapter is not None and ip_adapter is None:
 
76
  if not isinstance(self.pipe, StableDiffusionImg2ImgPipeline):
77
  self.pipe.image_encoder = None
78
  self.pipe.register_to_config(image_encoder=[None, None])
 
57
  attrs = ["b1", "b2", "s1", "s2"]
58
  has_freeu = all(getattr(block, attr, None) is not None for attr in attrs)
59
  if has_freeu and not freeu:
60
+ print("Disabling FreeU...")
61
  self.pipe.disable_freeu()
62
  elif not has_freeu and freeu:
63
  # https://github.com/ChenyangSi/FreeU
64
+ print("Enabling FreeU...")
65
  self.pipe.enable_freeu(b1=1.5, b2=1.6, s1=0.9, s2=0.2)
66
 
67
  def _load_ip_adapter(self, ip_adapter=None):
68
  if self.ip_adapter is None and self.ip_adapter != ip_adapter:
69
+ print(f"Loading IP Adapter: {ip_adapter}...")
70
  self.pipe.load_ip_adapter(
71
  "h94/IP-Adapter",
72
  subfolder="models",
73
  weight_name=f"ip-adapter-{ip_adapter}_sd15.safetensors",
74
  )
75
+ # TODO: slider for ip_scale
76
+ self.pipe.set_ip_adapter_scale(0.5)
77
  self.ip_adapter = ip_adapter
78
 
79
  if self.ip_adapter is not None and ip_adapter is None:
80
+ print("Unloading IP Adapter...")
81
  if not isinstance(self.pipe, StableDiffusionImg2ImgPipeline):
82
  self.pipe.image_encoder = None
83
  self.pipe.register_to_config(image_encoder=[None, None])