Nodes/ComfyUI_KimNodes/🍒LoRA_Metadata_Reader📋LoRA元数据读取器
ComfyUI Node

🍒LoRA_Metadata_Reader📋LoRA元数据读取器

Every LoRA you download has a training diary baked in — this node reads it

By wjl0313·Created 2 years ago·Updated 12 months ago· 54
🍒LoRA_Metadata_Reader📋LoRA元数据读取器
    • 元数据
    lora_fileNone

    If you've ever downloaded a LoRA and wondered what it was actually trained on, the answer has been sitting inside the file the whole time. LoRAs trained with kohya-ss sd-scripts (and the trainers that cloned its conventions) stamp a full training log into the safetensors header - network dim and alpha, learning rates, scheduler, resolution, dataset repeats, even the tag frequency table. ComfyUI's built-in loaders show you a sliver of that. LoRA_Metadata_Reader dumps the whole thing as a text blob you can actually read.

    This is, quietly, the most useful node in the KimNodes pack. It's the only one that does something ComfyUI can't do for you out of the box, and it needs no model files, no API, no keys. If you've ever grabbed a LoRA from Civitai and wanted the "training parameters" tab's contents without opening the model in a trainer, this is that tab, in a node.

    How it works

    The node scans your ComfyUI/models/loras folder for .safetensors files and builds a dropdown from them. Pick one and it reads the safetensors header directly - the first 8 bytes give the header length, then it parses the JSON inside and pulls the __metadata__ block (it falls back to safe_open if the direct read fails).

    The output is a single 元数据 (STRING) with everything arranged into sections: Basic Info (author, hash, version, the Civitai ssmd_* fields), Model Info (model type, file size, trigger words), Training Parameters grouped into network structure, basic, learning rate, dataset, optimization and "other", plus Dataset Info (image counts, repeats, weighted totals) and Tag Frequency (the top tags with relative percentages). It even sniffs whether it's a Flux LoRA from the base model field.

    The inputs that matter

    There's exactly one: lora_file, the dropdown of your installed LoRAs. That's the whole interface, and honestly it's the right call - there's nothing to tune, you just want the data. Wire the STRING output into a Show Text / Text node (or just read it in the node's output widget) and you're done.

    Installation

    This is one node in the wjl0313/ComfyUI_KimNodes pack, so you install the whole pack:

    • ComfyUI Manager → search "ComfyUI_KimNodes" → Install → Restart, or
    • cd ComfyUI/custom_nodes && git clone https://github.com/wjl0313/ComfyUI_KimNodes, then restart ComfyUI.

    The shipped requirements.txt only pins pixeloe; the reader itself just needs safetensors, which ComfyUI already bundles, so there's usually nothing extra to install for this node specifically.

    Common issues

    • "未选择LoRA文件" (no LoRA selected) - your models/loras folder is empty or the node loaded before you added files. Refresh and it'll repopulate.
    • Your file isn't in the list - only .safetensors files are shown. Old .ckpt LoRAs are invisible to it.
    • "错误:无法读取元数据" - the file genuinely has no metadata block (some hand-merged or pruned LoRAs have them stripped). That's the file's fault, not the node's.

    One thing to know: the ss_* fields it prints are Kohya conventions, so how much you get out depends on the trainer that made the LoRA. A file trained with an optimizer that writes rich headers gives you a novel; one from a barebones script gives you three lines. That's not a bug - that's the metadata actually being in there.

    Category🍒 Kim-Nodes/🔢Metadata | 元数据处理

    Inputs (1)

    NameTypeDefaultDescription
    lora_fileCOMBONone1 options: None

    Outputs (1)

    NameTypeDescription
    元数据STRING