Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee_LoRAMetadataExtractor
ComfyUI Node

EmAySee_LoRAMetadataExtractor

Read a LoRA's training secrets straight off the safetensors header

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee_LoRAMetadataExtractor
  • lora_upload
  • metadata_json_string
lora_filepath

The "what was this trained on, anyway?" node

Every LoRA file carries its birth certificate in the safetensors header: network dim and alpha, learning rate, optimizer, bucket configuration, dataset layout, and - if the trainer wrote it - the trigger words and tag-frequency tables. Most of the time you never look at it, and then you hit the one LoRA that came from a sketchy page or a dead CivitAI link and you need to know what checkpoint it targets and what its trigger word is. EmAySee_LoRAMetadataExtractor dumps all of that out as a readable JSON string.

It's the honest workhorse of EmAySee's LoRA corner, and its other life is dataset forensics: when you're inheriting someone's training set, checking that a LoRA wasn't secretly trained on bucketed chaos, or just satisfying curiosity about how ss_network_dim maps to the quality you're seeing. The training-world context matters here - those ss_ keys are Kohya-era conventions, and understanding them (rank, alpha, learning rate, buckets) is exactly what separates "someone trained this" from "someone trained this well."

How it works

It opens the .safetensors file with the safetensors library and reads the metadata block. Two paths: if the file stores a full Kohya config under __metadata__, it JSON-parses that wholesale and marks it _metadata_source: "Full Kohya_ss Config (__metadata__)". Older files store individual ss_-prefixed keys, so it iterates those, coerces strings into booleans/ints/floats, and specially JSON-parses the nested ss_tag_frequency, ss_bucket_info, and ss_datasets blobs. Either way you get a pretty-printed JSON string. If anything goes wrong, the error is returned as the output text rather than raising - so a bad path gives you Error: File not found at '...' in the string, not a crash.

Inputs and output

  • lora_filepath (STRING) - a full filesystem path to a .safetensors LoRA, e.g. /home/you/ComfyUI/models/loras/my_lora.safetensors. Relative names from ComfyUI's dropdown won't resolve.
  • lora_upload (LORA, optional) - accepted for drop-in compatibility, but the code notes it isn't actually used to resolve the path. The manual path string is the reliable route.

Output: metadata_json_string (STRING) - the formatted JSON.

Install

From ComfyUI_EmAySee_CustomNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
# restart ComfyUI

Or via ComfyUI Manager → "ComfyUI_EmAySee_CustomNodes". It uses the safetensors library, which ComfyUI already installs, so nothing extra to pip.

Gotchas

The category is a clue: it lives under "Mac Custom Nodes/LoRA Tools" - the author clearly copy-pasted that from a Mac-focused tutorial and never changed it. Search for it in the add-node menu under that path, not under EmAySee. The real user-facing trap is the path: you need an absolute filesystem path, so pair it with EmAySee_LoraFilePicker's full_filepath output and you'll stop fighting it. And beware the tag-frequency table - on a well-trained LoRA, ss_tag_frequency is a huge nested blob that buries the hyperparameters; if that annoys you, the sibling EmAySee_LoRAMetadataExtractorTagDrop version strips it on request.

CategoryMac Custom Nodes/LoRA Tools

Inputs (2)

NameTypeDefaultDescription
lora_filepathSTRING
lora_uploadoptLORA

Outputs (1)

NameTypeDescription
metadata_json_stringSTRING