Vector → Text / txt
Stop Squinting At tensor([0., 0., ..., 0.])
- vector
- text
- summary
- saved_path
- numel
- vector_out
Every time you try to look at a 2048-dim style vector in ComfyUI you hit the same wall. Show Text 🐍 (pysssss) declares its input as ("STRING", {"forceInput": True}), so it rejects a TENSOR link at the type level. Core Preview Any accepts it and then betrays you twice: it tries json.dumps on the tensor first, and it explicitly sets torch.set_printoptions(edgeitems=6) on top of torch's own threshold=1000. The result is six numbers, an ellipsis, and six numbers.
This node is the way out. It serializes the whole tensor to a STRING, optionally writes it straight to a txt file under output/, and hands you a stats summary so you can sanity-check the numbers without reading them.
What you get
Inputs: vector (any type - tensor, scalar or list; it's an any-type port), format (plain, comma, json, b64, lines), precision (9 - float32 needs 9 significant digits for a lossless round-trip, and b64 ignores precision entirely), and display_limit (0 shows the full text in the node's UI; any higher value truncates only the display, not the outputs). Optionally save_to_file (on by default), filename (lsnet_vector.txt) and subfolder (lsnet_vectors).
Outputs, in order:
- text - the complete serialization. No ellipsis, ever. This is the one to wire into a Show Text node or a save-text node.
- summary - shape, element count, dtype, norm, min, max, mean, std and a zero count. Genuinely useful: the norm is your fastest check for "did I accidentally normalize this" and the zero count tells you if the vector is mostly dead.
- saved_path - the absolute path actually written, empty if you turned saving off.
- numel - element count as an INT, handy for
if-style plumbing. - vector_out - a pass-through of the input tensor, and the reason it exists is subtle: wire it into Text / txt → Vector's
triggerinput to force ComfyUI to save before it tries to read. The engine has no idea one node's file is another node's input.
Picking a format
The author measured all five at 2048 dimensions, so this is data, not vibes:
- b64 - ~10,966 characters, bit-exact (raw float32 bytes plus a header carrying
dtypeandshape). Because the header carries shape, an(8, 2048)population comes back as a matrix, not a flat 16384-long mess. This is the archival format. - plain - ~18,479 characters, space-separated and human-readable, and at 9 significant digits the round-trip is lossless (
0.00e+00error in the author's tests). The right choice when you also want to eyeball or diff the file. - comma / lines - same size and accuracy as
plain, different separators.linesis nice forgrep-ing single elements. - json - ~25,481 characters, the one to pick when something other than ComfyUI has to read the file. It's also the only format that isn't strictly lossless: the JSON branch rounds to decimal places rather than significant figures, so across 60,000 sampled elements the author found 82 values off by one ulp (max error
9.3e-10). Irrelevant for a blend, not what you want for a bit-exact archive.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/let-the-name-be-x1/Computational-LSNet.git
# restart ComfyUI; nodes land under category "Computational LSNet"
Nothing to pip install - requirements.txt is empty on purpose and pyproject.toml sets dependencies = [], so Manager can't swap your torch/CUDA build behind your back. Manager users: search Computational LSNet, or comfy node install computational-lsnet once it's in the Registry.
This node doesn't need the LSNet classifier, the upstream plugin, or the 2.94 GB checkpoint - it's tensor-to-text and nothing else. If you do want the whole pipeline, you'll also need spawner1145/comfyui-kaloscope on its legacy branch (Manager's lsnet 1.0.8) plus models/lsnet/kaloscope2.0/ containing best_checkpoint.pth (≈2.94 GB), class_mapping.csv and config.json.
Where it goes wrong
You can't find the file. Saving is relative to ComfyUI's output/ directory, defaulting to the subfolder lsnet_vectors - so a save with the default settings is at ComfyUI/output/lsnet_vectors/lsnet_vector.txt, not in input/. Files land there whether you asked for a subfolder or not, because the subfolder widget has a default.
Everything overwrites itself. With the default filename every run writes the same path. That's how the pack's caching loops are supposed to behave - but for one-off archives, change the filename, or clear it and get a timestamp instead.
The UI feels sluggish with a big vector. 2048 elements at plain is around 18k characters the frontend is rendering. Set display_limit to 200 for the node's panel and read text elsewhere - the limit doesn't touch the outputs.
You saved json and the round-trip isn't bit-exact. Expected: use b64 (or plain) when exactness is the requirement.
Last thing, and it's why half this pack exists: don't try to feed tensors to generic display nodes. Save them here, read the summary, move on.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| vector | * | — | |
| format | COMBO | plain | 5 options: plain, comma, json, b64, lines |
| precision | INT | 91–12 | float32 无损往返需要 9 位有效数字;b64 格式与精度无关,逐比特无损 |
| display_limit | INT | 00–100000 | 0 = 界面文本完全显示;>0 只显示前 N 个值 |
| save_to_fileopt | BOOLEAN | true | — |
| filenameopt | STRING | lsnet_vector.txt | — |
| subfolderopt | STRING | lsnet_vectors | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| summary | STRING | — |
| saved_path | STRING | — |
| numel | INT | — |
| vector_out | TENSOR | — |