Nodes/ComfyUI Timesaver Nodes/TS Load Diffusion Model
ComfyUI Node

TS Load Diffusion Model

The `UNETLoader` for Locked Files, Plus the Detail Everyone Else Would Have Missed

By AlexYez·Created 2 years ago·Updated 4 days ago· 13
TS Load Diffusion Model
    • model
    unet_name
    weight_dtypedefault

    What it is

    Somebody sends you a .tsmodel diffusion model - a bare UNet/DiT, no CLIP, no VAE - and Load Diffusion Model doesn't list it. That's not a bug, that's the design: the extension is deliberately not registered with ComfyUI, so the stock loaders never offer a file they can't open. This node is the counterpart that can.

    The use case is delivery. You hand over weights you'd rather not have re-uploaded or quietly opened by another app, and the file stops being loadable by anything on the recipient's machine except this. As the pack's own README puts it, the lock guards against "just grab the file and load it" - there's no key, no password and no cryptography in the format, and anyone with the pack's source can take the lock off. It is not DRM, and pretending otherwise would be a lie you'd find out about on day one.

    How it works

    The .tsmodel wrapper is a safetensors file with the first 8 bytes - the header length - replaced by a magic marker, and the JSON header zlib-compressed so names, shapes and offsets aren't visible in a hex editor. The tensor data never moves: it stays byte for byte where it always was, with a trailer at the end recording the original header length, file size and a CRC32.

    This node's job after that is short and, notably, honest about what it doesn't know. It parses the header in memory and hands the state dict to comfy.sd.load_diffusion_model_state_dict - the exact function the stock UNETLoader uses. No architecture knowledge lives here at all, which is why every quantisation and every new architecture the core loader understands works here too, without the pack being updated for it.

    There is one small piece of housekeeping the author bothered with that you'd only notice if it were missing: the loaded model is given a cached_patcher_init, i.e. it remembers how to load itself again. ComfyUI uses that when it deep-clones a model or places it on a second GPU. Without it, the clone would come up holding no weights, and you'd find out much later, on the second card, with an error that points nowhere near the loader.

    Inputs and outputs

    unet_name - the .tsmodel file, listed from models/diffusion_models (subfolders and extra_model_paths.yaml folders included).

    weight_dtype - an advanced widget with the same four options the stock loader offers: default, fp8_e4m3fn, fp8_e4m3fn_fast, fp8_e5m2. Those map to the same model options the core node builds, so the fp8 casting trade is the same one you already know: less VRAM, some quality, and the _fast variant turning on fp8 optimisations. Leave it on default unless you're chasing memory.

    One output: model, into whatever sampler or patch chain you were going to use.

    Install

    ComfyUI Manager → search Timesaver, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AlexYez/comfyui-timesaver
    cd comfyui-timesaver
    python -m pip install -r requirements.txt
    

    Restart ComfyUI. Nothing to download for this node, no optional extra needed - the reader ships with the pack. The pack as a whole is 76 nodes and expects the V3 node API (comfy_api.v0_0_2), so a reasonably current ComfyUI.

    When it goes wrong

    The dropdown is empty. It scans every folder registered for diffusion_models, so the file is either somewhere ComfyUI doesn't look or under a name that doesn't end in .tsmodel. Everything else in the ComfyUI model list being visible while this one is bare is the normal, expected state - the extension is intentionally invisible to the stock loaders.

    Could not detect the model type of … The file opened fine, so this is the model itself, not the lock. The header parsed, the tensors are readable, and the weights aren't a shape ComfyUI recognises. That's a statement about the model, not about the format, and it saves you from re-downloading a file that was never the problem.

    Loading feels normal, which is the point. The tensors go through the same mmap path as any other safetensors model, so there's no RAM or VRAM penalty hiding here - the only extra work is unpacking a header. If a locked model loads slowly, suspect the disk, not the lock.

    For a full checkpoint in the same format you want TS Load Checkpoint; for an adapter, TS Load LoRA, model only.

    CategoryTS/Loaders

    Inputs (2)

    NameTypeDefaultDescription
    unet_nameCOMBOA .tsmodel file from models/diffusion_models. The stock loaders do not list these — that is the whole point of the lock.
    weight_dtypeCOMBOdefaultSame weight casting the stock UNETLoader offers.

    Outputs (1)

    NameTypeDescription
    modelMODEL