Skip to content

Commit

Permalink
hotfix: Scheduled CFGGuider - invalid fallback handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed Jun 22, 2024
1 parent 78444b5 commit d150ca3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import importlib

version_code = [0, 80, 2]
version_code = [0, 80, 3]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
print(f"### Loading: ComfyUI-Inspire-Pack ({version_str})")

Expand Down
7 changes: 6 additions & 1 deletion inspire/sampler_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def __init__(self, model_patcher, sigmas, from_cfg, to_cfg, schedule):
self.from_cfg = from_cfg
self.to_cfg = to_cfg
self.schedule = schedule
self.last_i = 0
self.renew_cfg_sigmas()

def set_cfg(self, cfg):
Expand All @@ -199,13 +200,16 @@ def renew_cfg_sigmas(self):
self.cfg_sigmas_i[i] = self.cfg_sigmas[k]
i += 1

print(f"self.cfg_sigmas: {self.cfg_sigmas}")

def predict_noise(self, x, timestep, model_options={}, seed=None):
k = float(timestep[0])

v = self.cfg_sigmas.get(k)
if v is None:
# fallback
v = self.cfg_sigmas_i[self.last_i+1]
self.cfg_sigmas[k] = v

self.last_i = v[1]
self.cfg = v[0]
Expand All @@ -224,8 +228,8 @@ def __init__(self, model_patcher, sigmas, from_cfg, to_cfg, schedule, neg_scale)
self.to_cfg = to_cfg
self.schedule = schedule
self.neg_scale = neg_scale
self.renew_cfg_sigmas()
self.last_i = 0
self.renew_cfg_sigmas()

def set_cfg(self, cfg):
self.default_cfg = cfg
Expand Down Expand Up @@ -256,6 +260,7 @@ def predict_noise(self, x, timestep, model_options={}, seed=None):
if v is None:
# fallback
v = self.cfg_sigmas_i[self.last_i+1]
self.cfg_sigmas[k] = v

self.last_i = v[1]
self.cfg = v[0]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui-inspire-pack"
description = "This extension provides various nodes to support Lora Block Weight and the Impact Pack. Provides many easily applicable regional features and applications for Variation Seed."
version = "0.80.2"
version = "0.80.3"
license = "LICENSE"
dependencies = ["matplotlib", "cachetools"]

Expand Down

0 comments on commit d150ca3

Please sign in to comment.