diff --git a/README.md b/README.md index a2c3e31..a231b5e 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,12 @@ Treat curves/schedules and keyframes as objects that can be passed around, plugg # Starter Workflows + ## Prompt Scheduling ![Prompt Scheduling](examples/prompt-scheduling.png) + ## Prompt Interleaving (aka Prompt Entanglement, aka Prompt Superposition) ![Prompt Entanglement](examples/prompt-entanglement.png) @@ -26,11 +28,72 @@ Which is the node equivalent for achieving this type of thing ![](https://pbs.twimg.com/media/Fqcdhe4agAEnJ-L?format=jpg&name=large) + ## Simple Curved Parameter ![Simple Curved Parameter](examples/simple-curved-parameter.png) + ## Multi-Prompt Transition With Manually Specified Curves ![Manual Prompt Transition](examples/manual-prompt-transition.png) + +# Nodes + +## Curve Constructors + +### Curve From String + +![Curve From String](assets/node_curve-from-string.png) + + +### Curve From YAML + +![Curve From YAML](assets/node_curve-from-yaml.png) + + +### Constant-Valued Curve + +![Curve From YAML](assets/node_constant-valued-curve.png) + + +## Curve Operators + +### Evaluate Curve At T + +![Evaluate Curve At T](assets/node_evaluate-curve-at-t.png) + + +### Apply Curve To Conditioning + +![Apply Curve To Conditioning](assets/node_apply-curve-to-conditioning.png) + + +### Add Conditions + +![Apply Curve To Conditioning](assets/node_add-conditions.png) + + +### Curve Arithmetic Operators + +![Curve Arithmetic](assets/nodes_curve-arithmetic.png) + +NB: the division operator is unreliable at the time of this writing (2023-12-09). + + +## Scheduling + +### Keyframed Condition + +![Keyframed Condition](assets/node_keyframed-condition.png) + + +### Set Keyframe + +![Set Keyframe](assets/node_set-keyframe.png) + +### Evaluate Schedule + +![Evaluate Schedule](assets/nodes_evaluate-schedule.png) + diff --git a/assets/node_add-conditions.png b/assets/node_add-conditions.png new file mode 100644 index 0000000..e0c65ea Binary files /dev/null and b/assets/node_add-conditions.png differ diff --git a/assets/node_apply-curve-to-conditioning.png b/assets/node_apply-curve-to-conditioning.png new file mode 100644 index 0000000..1c607d1 Binary files /dev/null and b/assets/node_apply-curve-to-conditioning.png differ diff --git a/assets/node_constant-valued-curve.png b/assets/node_constant-valued-curve.png new file mode 100644 index 0000000..dc3b6bf Binary files /dev/null and b/assets/node_constant-valued-curve.png differ diff --git a/assets/node_curve-from-string.png b/assets/node_curve-from-string.png new file mode 100644 index 0000000..47354da Binary files /dev/null and b/assets/node_curve-from-string.png differ diff --git a/assets/node_curve-from-yaml.png b/assets/node_curve-from-yaml.png new file mode 100644 index 0000000..0b0fd00 Binary files /dev/null and b/assets/node_curve-from-yaml.png differ diff --git a/assets/node_evaluate-curve-at-t.png b/assets/node_evaluate-curve-at-t.png new file mode 100644 index 0000000..41506b0 Binary files /dev/null and b/assets/node_evaluate-curve-at-t.png differ diff --git a/assets/node_keyframed-condition.png b/assets/node_keyframed-condition.png new file mode 100644 index 0000000..7f4ecca Binary files /dev/null and b/assets/node_keyframed-condition.png differ diff --git a/assets/node_set-keyframe.png b/assets/node_set-keyframe.png new file mode 100644 index 0000000..288ba56 Binary files /dev/null and b/assets/node_set-keyframe.png differ diff --git a/assets/nodes_curve-arithmetic.png b/assets/nodes_curve-arithmetic.png new file mode 100644 index 0000000..7dc753e Binary files /dev/null and b/assets/nodes_curve-arithmetic.png differ diff --git a/assets/nodes_evaluate-schedule.png b/assets/nodes_evaluate-schedule.png new file mode 100644 index 0000000..5fd2192 Binary files /dev/null and b/assets/nodes_evaluate-schedule.png differ diff --git a/nodes/core.py b/nodes/core.py index 7c7f965..b00e763 100644 --- a/nodes/core.py +++ b/nodes/core.py @@ -427,4 +427,5 @@ NODE_DISPLAY_NAME_MAPPINGS = { "KfCurvesSubtract": "Curve_1 - Curve_2", "KfCurvesMultiply": "Curve_1 * Curve_2", "KfCurvesDivide": "Curve_1 / Curve_2", + "KfCurveConstant": "Constant-Valued Curve", } \ No newline at end of file diff --git a/nodes/schedule.py b/nodes/schedule.py index 2b5fe87..ad20acd 100644 --- a/nodes/schedule.py +++ b/nodes/schedule.py @@ -68,17 +68,23 @@ class KfSetKeyframe: } } def main(self, keyframed_condition, schedule=None): + keyframed_condition = deepcopy(keyframed_condition) cond_dict = keyframed_condition.pop("cond_dict") - cond_dict = deepcopy(cond_dict) + #cond_dict = deepcopy(cond_dict) if schedule is None: - curve_tokenized = kf.Curve([keyframed_condition["kf_cond_t"]], label="kf_cond_t") + # get a new copy of the tensor + kf_cond_t = keyframed_condition["kf_cond_t"] + #kf_cond_t.value = kf_cond_t.value.clone() # should be redundant with the deepcopy + curve_tokenized = kf.Curve([kf_cond_t], label="kf_cond_t") curves = [curve_tokenized] if keyframed_condition["kf_cond_pooled"] is not None: - curve_pooled = kf.Curve([keyframed_condition["kf_cond_pooled"]], label="kf_cond_pooled") + kf_cond_pooled = keyframed_condition["kf_cond_pooled"] + curve_pooled = kf.Curve([kf_cond_pooled], label="kf_cond_pooled") curves.append(curve_pooled) schedule = (kf.ParameterGroup(curves), cond_dict) else: + schedule = deepcopy(schedule) schedule, old_cond_dict = schedule for k, v in keyframed_condition.items(): if (v is not None): @@ -91,6 +97,7 @@ class KfSetKeyframe: def evaluate_schedule_at_time(schedule, time): + schedule = deepcopy(schedule) schedule, cond_dict = schedule #cond_dict = deepcopy(cond_dict) values = schedule[time] @@ -98,8 +105,9 @@ def evaluate_schedule_at_time(schedule, time): cond_pooled = values.get("kf_cond_pooled") if cond_pooled is not None: #cond_dict = deepcopy(cond_dict) - cond_dict["pooled_output"] = cond_pooled.clone() - return [(cond_t.clone(), cond_dict)] + cond_dict["pooled_output"] = cond_pooled #.clone() + #return [(cond_t.clone(), cond_dict)] + return [(cond_t, cond_dict)] class KfGetScheduleConditionAtTime: @@ -162,4 +170,9 @@ NODE_CLASS_MAPPINGS = { "KfGetScheduleConditionSlice": KfGetScheduleConditionSlice, } -NODE_DISPLAY_NAME_MAPPINGS = {} +NODE_DISPLAY_NAME_MAPPINGS = { + "KfKeyframedCondition": "Keyframed Condition", + "KfSetKeyframe": "Set Keyframe", + "KfGetScheduleConditionAtTime": "Evaluate Schedule At T", + "KfGetScheduleConditionSlice": "Evaluate Schedule At T (Batch)", +} \ No newline at end of file