Pt Size To String
A tensor shape as a string you can read, log, or wire onward
- sz
- STRING
Pt Size To String turns a PTSIZE - the pack's shape object - into a plain string. It's the pack's size-to-text bridge, and it's the node you'll grab when you want a tensor's shape as something you can read, display, or feed into text-handling parts of a workflow. It's smaller than it sounds and that's fine: it's a formatting utility, and it does exactly one job.
What it actually does
It takes a PTSIZE and returns str(sz), the Python string representation of the size. Give it torch.Size([2, 3, 96, 32]) and you get the text torch.Size([2, 3, 96, 32]). One input, one output, no options to set.
Where it shines is logging and debugging. Combine it with Pt Size to extract a shape, convert it here, and feed the string into Pt Show Text or any text display in your graph - now your workflow can tell you what shape things had at that point, which is genuinely useful in a training pipeline where shapes change as data flows through models and batch operations. It also lets you compare shapes as strings or build filenames and labels that include shape information.
Only one input:
- sz - a
PTSIZEfrom Pt Size or Pt Size Create.
Output is a single STRING.
How to install it
It's part of the ComfyUI-Pt-Wrapper pack. ComfyUI Manager: search ComfyUI-Pt-Wrapper, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart after. The pack's requirements.txt is heavy (transformers, datasets, accelerate, peft, gensim, sentencepiece, pandas, scikit-learn, scipy) - slow first install, and version conflicts with other nodes pinning different transformers versions are possible.
Gotchas
The main gotcha is that a PTSIZE won't wire into nodes outside this pack, so this node is how you get the shape into the wider string world - but the reverse isn't true. You can't parse the string back into a PTSIZE with a node in this set; if you need the shape as data again, keep a branch from the original PTSIZE rather than round-tripping through text.
Also, don't confuse this with Pt Show Size. This one outputs a usable STRING that flows forward into other nodes; Pt Show Size is an output node that displays in the UI. Same family, different jobs. If you want the shape both visible and usable, wire both from the same PTSIZE.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| sz | PTSIZE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |