[Log] Info: FunPack Diffusion Model Loader | flux.safetensors loaded, attention sage
[Log] Alert: MiniMaxH3ImageToVideo node | no "first_image" input is connected
[Log] Warning: FunPack LoRA Loader | style.safetensors is empty and will not load
[Log] Critical: torch | cannot allocate 14 GB (3 GB free); the run will not start
The difference between the middle two is the one that matters. Alert is a
choice you may not have made on purpose. Warning is something that will NOT
do what its name says -- the level v4 needed and did not have, which is how
560 handlers came to swallow a failure and carry on, so a feature could be
switched on, do nothing, and never say so.
Info is not decoration either: "loaded on GPU using sage attention" is how
an attention setting that did nothing gets noticed months before the
pictures look wrong enough to investigate.
Every call site moved -- there is no note() left to be vague through -- and
the loaders now say what they actually loaded rather than only what they
were asked for. Records are kept in a bounded ring as well as printed, so a
long rental session cannot turn the log into a memory leak, and served at
/funpack/api/log so a person can read it somewhere other than a terminal
full of ComfyUI's own output. There is a page for it.
Also dropped the preflight this was traded for: min and max are already
declared and already enforced at both doors, and a second protection layer
around a check that exists is ceremony.
Two mistakes worth keeping: a log line reached into the model's shape to
describe it and could have failed the load it was only narrating; and both
new pages passed `children` to an element that takes `rows`, which the kit
accepted and silently dropped. It throws on an unknown element and not on an
unknown prop.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
60 lines
2.2 KiB
Python
60 lines
2.2 KiB
Python
"""Loading a VAE, with an explicit dtype and a report of what happened.
|
|
|
|
Two differences from core's VAELoader, both carried over from v4 where they were
|
|
proven: the dtype is chosen rather than guessed, and a second output narrates
|
|
what actually loaded. Silent success that produced the wrong thing is the failure
|
|
mode these exist to remove.
|
|
"""
|
|
|
|
import comfy.sd
|
|
import comfy.utils
|
|
import folder_paths
|
|
import torch
|
|
from comfy_api.latest import io
|
|
|
|
from ..._core import log
|
|
|
|
# Chosen, not inferred. bf16 is the default because fp16 is a known failure on
|
|
# the AV VAEs, and fp32 decodes slowly for no visible gain.
|
|
DTYPES = {
|
|
"bfloat16": torch.bfloat16,
|
|
"float16": torch.float16,
|
|
"float32": torch.float32,
|
|
}
|
|
|
|
|
|
def vae_files():
|
|
# Empty is a legitimate state -- a fresh install has no models. Returning an
|
|
# empty list lets the node exist and say so, rather than failing to register.
|
|
return folder_paths.get_filename_list("vae")
|
|
|
|
|
|
class FunPackVAELoader(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls) -> io.Schema:
|
|
return io.Schema(
|
|
# Frozen once shipped: this string is stored as `class_type` in every
|
|
# saved workflow, so changing it silently breaks them.
|
|
node_id="FunPackVAELoader",
|
|
display_name="FunPack VAE Loader",
|
|
category="FunPack/Loaders",
|
|
description="Load a VAE with an explicit compute dtype.",
|
|
inputs=[
|
|
io.Combo.Input("vae_name", options=vae_files()),
|
|
io.Combo.Input("dtype", options=list(DTYPES), default="bfloat16"),
|
|
],
|
|
outputs=[
|
|
io.Vae.Output(display_name="vae"),
|
|
io.String.Output(display_name="status"),
|
|
],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, vae_name: str, dtype: str) -> io.NodeOutput:
|
|
path = folder_paths.get_full_path_or_raise("vae", vae_name)
|
|
state_dict = comfy.utils.load_torch_file(path)
|
|
vae = comfy.sd.VAE(sd=state_dict, dtype=DTYPES[dtype])
|
|
vae.throw_exception_if_invalid()
|
|
log.info("FunPack VAE Loader", f"{vae_name} loaded as {dtype}")
|
|
return io.NodeOutput(vae, f"{vae_name} loaded as {dtype}")
|