Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detail daemon sampler node #260

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions bizyair_extras/nodes_sd3.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,61 @@ def INPUT_TYPES(s):
NODE_DISPLAY_NAME = "Apply Controlnet with VAE"
RETURN_TYPES = (data_types.CONDITIONING, data_types.CONDITIONING)
RETURN_NAMES = ("positive", "negative")


class DetailDaemonSampler(BizyAirBaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"sampler": ("SAMPLER",),
"detail_amount": (
"FLOAT",
{"default": 0.1, "min": -5.0, "max": 5.0, "step": 0.01},
),
"start": (
"FLOAT",
{"default": 0.2, "min": 0.0, "max": 1.0, "step": 0.01},
),
"end": (
"FLOAT",
{"default": 0.8, "min": 0.0, "max": 1.0, "step": 0.01},
),
"bias": (
"FLOAT",
{"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01},
),
"exponent": (
"FLOAT",
{"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.05},
),
"start_offset": (
"FLOAT",
{"default": 0.0, "min": -1.0, "max": 1.0, "step": 0.01},
),
"end_offset": (
"FLOAT",
{"default": 0.0, "min": -1.0, "max": 1.0, "step": 0.01},
),
"fade": (
"FLOAT",
{"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.05},
),
"smooth": ("BOOLEAN", {"default": True}),
"cfg_scale_override": (
"FLOAT",
{
"default": 0,
"min": 0.0,
"max": 100.0,
"step": 0.5,
"round": 0.01,
"tooltip": "If set to 0, the sampler will automatically determine the CFG scale (if possible). Set to some other value to override.",
},
),
}
}

RETURN_TYPES = ("SAMPLER",)
CATEGORY = "sampling/custom_sampling/samplers"
NODE_DISPLAY_NAME = "Detail Daemon Sampler"
65 changes: 59 additions & 6 deletions tools/convert_to_bizyair.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,79 @@ def get_bizyair_display_name(class_type: str) -> str:
return f"{bizyair_logo}{bizyair_cls_prefix} {bizyair.NODE_DISPLAY_NAME_MAPPINGS.get(class_type, class_type)}"


def convert_to_bizyair(inputs: dict):
bizyair.NODE_CLASS_MAPPINGS
def get_trans_format(inputs: dict):
if "nodes" in inputs:
return "workflow"
return "workflow_api"


def workflow_convert(inputs: dict, status):
nodes = inputs["nodes"]
for node in nodes:
class_type = node["type"]
node_inputs = node.get("inputs")
node_outputs = node.get("outputs")

bizyair_cls_type = f"{bizyair.nodes_base.PREFIX}_{class_type}"

if bizyair_cls_type in bizyair.NODE_CLASS_MAPPINGS:
node["type"] = bizyair_cls_type

display_name = get_bizyair_display_name(class_type)
node["properties"]["Node name for S&R"] = display_name

if node_inputs:
for input_node in node_inputs:
input_type = input_node["type"]
input_node["type"] = f"{bizyair.nodes_base.PREFIX}_{input_type}"

if node_outputs:
for output_node in node_outputs:
output_type = output_node["type"]
output_node["type"] = f"{bizyair.nodes_base.PREFIX}_{output_type}"
status = True
pprint.pprint(
{
"original_class_type": class_type,
"bizyair_cls_type": bizyair_cls_type,
"is_converted": status,
}
)

return (inputs, status)


def workflow_api_convert(inputs: dict, status):
for x in inputs.copy():
class_type = inputs[x]["class_type"]
bizyair_cls_type = f"{bizyair.nodes_base.PREFIX}_{class_type}"
is_converted = False
if bizyair_cls_type in bizyair.NODE_CLASS_MAPPINGS:
inputs[x]["class_type"] = bizyair_cls_type
display_name = get_bizyair_display_name(class_type)
inputs[x]["_meta"]["title"] = display_name
is_converted = True

status = True
pprint.pprint(
{
"original_class_type": class_type,
"bizyair_cls_type": bizyair_cls_type,
"is_converted": is_converted,
"is_converted": status,
}
)

return (inputs, status)


def convert_to_bizyair(inputs: dict):
bizyair.NODE_CLASS_MAPPINGS

is_converted = False
input_format = get_trans_format(inputs)
if input_format == "workflow_api":
inputs, is_converted = workflow_api_convert(inputs, is_converted)
elif input_format == "workflow":
inputs, is_converted = workflow_convert(inputs, is_converted)
assert is_converted == True

return inputs


Expand Down
Loading