LoadTorchTensor
Pull a saved .pt tensor back into your ComfyUI graph
- TORCH_TENSOR
You saved a tensor with SaveTorchTensor (or anyone's torch.save) and now you want it back in the graph. LoadTorchTensor is that reverse operation: give it a file path and it runs torch.load(file) and hands you the result as a TORCH_TENSOR. It's the persistence side of this pack's tensor lifecycle - save your features, labels, or processed data to disk, load them in a fresh workflow, and skip re-downloading or recomputing everything.
It's a genuinely useful node for ML-in-ComfyUI work because torch.load/torch.save is the native PyTorch serialization format - the round-trip is lossless, fast, and dtype-exact, unlike saving to CSV or PNG. Anything the pack (or any torch code) saved as a .pt file comes back byte-for-byte the same.
How it works
The file input is a path string - the default is the placeholder /somewhere/some.pt, which you must replace with a real path. The node calls torch.load(file) and returns the tensor. Note there are no browse widgets or ComfyUI folder_paths integration here - you're typing a path your ComfyUI process can actually read. Relative paths resolve against ComfyUI's working directory, which can surprise you; an absolute path removes the guesswork.
Input and output
- file (
STRING) - the.ptfile path to load. - Output: one
TORCH_TENSOR.
Install
ComfyUI Manager, search "EternalKernel PyTorch Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/TashaSkyUp/EternalKernelPytorchNodes
cd EternalKernelPytorchNodes
pip install -r requirements.txt
Restart ComfyUI; node under ETK/pytorch. No model files. Requirements are the standard ComfyUI stack plus scipy, scikit-learn, transformers, einops.
Common issues
- File not found / wrong working directory. The #1 complaint. Relative paths resolve against where you launched ComfyUI, not where the node "looks." Use an absolute path like
C:/data/my_tensor.ptor/home/user/data/my_tensor.ptto be sure. - Loading non-tensor objects. This node doesn't validate what's in the file.
torch.loadon a state dict or a whole model returns that object instead of a tensor, and you'll only notice when a tensor node downstream misbehaves. Make sure the file actually contains a tensor (i.e. it was saved withtorch.save(tensor, ...), asSaveTorchTensordoes). - Path typos and slashes. Windows backslashes in a JSON workflow can escape badly. Forward slashes work everywhere.
- Untrusted files.
torch.loadwill happily deserialize arbitrary pickles. Loading a.ptfile you didn't create runs code from whoever made it - standard pickle-safety warning, and this node doesn't addweights_only=Trueprotection. Load only your own files.
It's a quiet pack with no tutorials, but this node is a one-line wrapper around torch.load, so PyTorch's serialization docs are the authority. And the pack-wide quirk - it patches ComfyUI's validator to ignore return_type_mismatch - means a mismatched wire may not error out; verify types yourself.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file | STRING | /somewhere/some.pt | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TORCH_TENSOR | TORCH_TENSOR | — |