Skip to content

Commit

Permalink
Fix getting steps for SamplerCustom node.
Browse files Browse the repository at this point in the history
  • Loading branch information
shiimizu committed Nov 25, 2023
1 parent e9ecab1 commit b567095
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions smZNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,9 @@ def find_nearest_ksampler(clip_id):
def get_steps(graph, node_id):
node = graph.get(str(node_id), {})
steps_input_value = node.get("inputs", {}).get("steps", None)

if steps_input_value is None:
steps_input_value = node.get("inputs", {}).get("sigmas", None)

while(True):
# Base case: it's a direct value
if isinstance(steps_input_value, (int, float, str)):
Expand All @@ -782,9 +784,11 @@ def get_steps(graph, node_id):
elif isinstance(steps_input_value, list):
ref_node_id, ref_input_index = steps_input_value
ref_node = graph.get(str(ref_node_id), {})
keys = list(ref_node.get("inputs", {}).keys())
ref_input_key = keys[ref_input_index % len(keys)]
steps_input_value = ref_node.get("inputs", {}).get(ref_input_key)
steps_input_value = ref_node.get("inputs", {}).get("steps", None)
if steps_input_value is None:
keys = list(ref_node.get("inputs", {}).keys())
ref_input_key = keys[ref_input_index % len(keys)]
steps_input_value = ref_node.get("inputs", {}).get(ref_input_key)
else:
return None

Expand Down

0 comments on commit b567095

Please sign in to comment.