feat: the model loader's fields read in order: file, storage, attention, then SLA as its choices narrow it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fc92e5869b
commit
8fabfe3b3f
@@ -102,6 +102,11 @@ def describe(class_type: str) -> Optional[dict]:
|
||||
sub = dict(_one(dotted, decl, req), shows=[{"input": parent, "when": keys}])
|
||||
(widgets if sub["type"] in PRIMITIVE and not sub.get("forceInput") else sockets).append(sub)
|
||||
|
||||
# A node may say how its fields read best (WIDGET_ORDER); unnamed ones keep their place after those.
|
||||
order = list(getattr(node, "WIDGET_ORDER", ()) or ())
|
||||
if order:
|
||||
widgets.sort(key=lambda w: order.index(w["name"]) if w["name"] in order else len(order))
|
||||
|
||||
outputs = list(getattr(node, "RETURN_TYPES", ()) or ())
|
||||
# RETURN_NAMES is optional even on a well-formed node -- absent means
|
||||
# "named after its type", which is what ComfyUI's own frontend falls back
|
||||
|
||||
@@ -38,6 +38,13 @@ def shows(*conditions):
|
||||
return {"funpack_shows": [{"input": name, "when": list(values)} for name, values in conditions]}
|
||||
|
||||
class FunPackDiffusionModelLoader(io.ComfyNode):
|
||||
# How the form lists them (core/widgets): the file, how it is stored and computed, attention, then SLA in the
|
||||
# order its choices narrow it. Not the schema's order, which saved canvas workflows read by position.
|
||||
WIDGET_ORDER = ("model_name", "weight_dtype", "int8_convrot", "compute_dtype", "fp16_accumulation", "attention",
|
||||
"sla", "sla_method", "sla_engine", "sla_sparsity", "sla_tau", "sla_block_size",
|
||||
"sla_dense_steps", "sla_dense_last_steps", "sla_min_seq_len", "sla_protect_audio",
|
||||
"sla_references", "sla_tail", "sla_stabilize_motion")
|
||||
|
||||
@classmethod
|
||||
def define_schema(cls) -> io.Schema:
|
||||
return io.Schema(
|
||||
|
||||
@@ -502,3 +502,9 @@ def test_the_loader_draws_each_sla_field_only_in_its_mode():
|
||||
assert rules["sla_block_size"]["sla_engine"] == ["triton"] and rules["sla_tail"]["sla_engine"] == ["comfy_kitchen"]
|
||||
assert all(r.get("sla") == [True] for name, r in rules.items() if name.startswith("sla_"))
|
||||
assert rules["sla"] == {} and rules["int8_convrot"] == {}
|
||||
|
||||
|
||||
def test_the_loaders_fields_are_listed_in_reading_order():
|
||||
from modules.loaders.diffusion_model.nodes import FunPackDiffusionModelLoader as L
|
||||
named = [i.id for i in L.define_schema().inputs]
|
||||
assert sorted(L.WIDGET_ORDER) == sorted(named) # every field placed, none invented
|
||||
|
||||
Reference in New Issue
Block a user