ComfyUI Extension: ComfyUI-Pt-Wrapper
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
PyTorch extension for ComfyUI featuring extensive PyTorch wrapper nodes for seamless tensor operations and PyTorch model training.
Looking for a different extension?
Custom Nodes (212)
- Hf Tokenizer Encode
- Pt Abs
- Pt Acos
- Pt Add
- Pt Apply Function
- Pt Arange
- Pt Argmax
- Pt Argmin
- Pt Asin
- Pt Atan
- Pt Bitwise And
- Pt Bitwise Left Shift
- Pt Bitwise Not
- Pt Bitwise Or
- Pt Bitwise Right Shift
- Pt Bitwise Xor
- Pt Bmm
- Pt Bool Create
- Pt Compute Loss
- Pt Concat
- Pt Cos
- Pt Cosh
- Pt Crop
- Pt Data Loader
- Pt Data Loader From Tensors
- Ptd Bernoulli
- Ptd Beta
- Ptd Binomial
- Ptd Categorical
- Ptd Chi2
- Ptd Exponential
- Ptd Gamma
- Pt Div
- Ptdm Cdf
- Ptdm Cdf Tensor
- Ptdm Icdf
- Ptdm Icdf Tensor
- Ptdm Log Prob
- Ptdm Log Prob Tensor
- Ptdm Pdf
- Ptdm Pdf Tensor
- Ptdm Pmf
- Ptdm Pmf Tensor
- Ptdm Sample
- Ptd Normal
- Ptd Poisson
- Ptd Student T
- Ptd Uniform
- Pt Einsum
- Pt Eq
- Pt Evaluate Classification Model
- Pt Exp
- Ptf GELU
- Pt Flatten
- Ptf Leaky ReLU
- Pt Float Create
- Ptf Log Softmax
- Pt Floor Div
- Ptf ReLU
- Pt From Image
- Pt From Image Transpose
- Pt From Latent
- Pt From Numpy
- Ptf Sigmoid
- Ptf SiLU
- Ptf Softmax
- Ptf Softplus
- Ptf Tanh
- Pt Full
- Pt Gather
- Pt Ge
- Pt Gt
- Pt Index Select
- Pt Int Create
- Pt Interpolate By Scale Factor
- Pt Interpolate To Size
- Pt Le
- Pt Linspace
- Pt Load Model
- Pt Log
- Pt Logical And
- Pt Logical Not
- Pt Logical Or
- Pt Logical Xor
- Pt Lt
- Pt Masked Select
- Pt Mat Mul
- Pt Max
- Pt Mean
- Pt Median
- Pt Min
- Pt Mm
- Pt Mul
- Ptn Avg Pool 2d
- Ptn Batch Norm 2d
- Ptn BCE Loss
- Ptn BCE With Logits Loss
- Ptn Chained Model
- Ptn Chained Model With Attention Mask
- Ptn Conv 2d
- Ptn Conv Model
- Ptn Cross Entropy Loss
- Pt Ne
- Pt Neg
- Ptn Embedding
- Ptn Embedding RNN Linear
- Ptn Embedding Transformer Linear
- Ptn GRU
- Ptn GRU Linear
- Ptn Hf Fine Tuned Classification Model
- Ptn Hf Lora Classification Model
- Ptn Huber Loss
- Ptn Instance Norm 2d
- Ptn KL Div Loss
- Ptn L1 Loss
- Ptn Layer Norm
- Ptn Linear
- Ptn Linear Model
- Ptn LSTM
- Ptn LSTM Linear
- Ptn Masked Mean Pooling
- Ptn Max Pool 2d
- Ptn Model With Closure
- Ptn MSE Loss
- Ptn Multihead Attention
- Ptn Multihead Attention Custom
- Ptn NLL Loss
- Ptn Pre Add Channel Axis
- Ptn Pre Flatten
- Ptn Residual Connection Model
- Ptn Residual Connection Model With Attention Mask
- Ptn Resnet Model
- Ptn RNN
- Ptn RNN Linear
- Ptn Smooth L1 Loss
- Pto Adam
- Pto AdamW
- Pto Lr Scheduler Cosine Annealing
- Pto Lr Scheduler Reduce On Plateau
- Pto Lr Scheduler Step
- Pt Ones
- Pto SGD
- Pto Simple
- Pt Pad
- Pt Permute
- Pt Pow
- Pt Predict Classification Model
- Pt Predict Regression Model
- Pt Prod
- Pt Rand
- Pt Rand Int
- Pt Randn
- Pt Remainder
- Pt Reshape
- Pt Save Model
- Pt Scatter
- Pt Show Size
- Pt Show Text
- Pt Sin
- Pt Sinh
- Pt Size
- Pt Size Create
- Pt Size To Numpy
- Pt Size To String
- Pt Sqrt
- Pt Squeeze
- Pt Stack
- Pt Std
- Pt Sub
- Pt Sum
- Pt Tan
- Pt Tanh
- Pt To Bfloat16
- Pt To Float16
- Pt To Float32
- Pt To Float64
- Pt To Image
- Pt To Image Transpose
- Pt To Int16
- Pt To Int32
- Pt To Int64
- Pt To Int8
- Pt Tokenizer
- Pt To Latent
- Pt To Numpy
- Pt To Rgb Tensors
- Pt To Uint8
- Pt Train Classification Model
- Pt Train Classification Model Lr
- Pt Train Classification Transformer Model
- Pt Train Fine Tune Classification Transformer Model
- Pt Train Model
- Pt Train Regression Model
- Pt Train RNN Model
- Pt Unsqueeze
- Pt Var
- Ptv Dataset
- Ptv Dataset Len
- Ptv Dataset Loader
- Ptv Hf Dataset With Token Encode
- Ptv Hf Glove Dataset
- Ptv Hf Local Dataset
- Pt View
- Ptv Image Folder Dataset
- Ptv Sequential Tensor Dataset
- Ptv Transforms Data Augment
- Ptv Transforms Resize
- Ptv Transforms To Tensor
- Pt Where
- Pt Zeros
- Sp Encode
- Sp Load Model
README

Update — April 6, 2025
Now You Can Try Building a Transformer Model from Scratch
You can use ComfyUI-Pt-Wrapper to build a Transformer encoder model from scratch for text classification.
Learn how to construct a Transformer encoder using basic components such as multi-head attention, layer normalization, linear layers, embedding layers, and residual connections. This workflow allows you to train the model for IMDB text classification and achieve around 85% accuracy!

The complete setup of all required nodes is included in the example workflow.
Check out the Building Transformer From Scratch guide.
ComfyUI-Pt-Wrapper
ComfyUI-Pt-Wrapper brings PyTorch model building and training into ComfyUI's node graph environment—no coding required.
It is built for ComfyUI users who want to explore machine learning without writing Python, and for researchers who want to prototype directly in visual workflows. Every operation, from tensor math to full training pipelines, can be configured through nodes.
Originally a focused spin-off of ComfyUI-Data-Analysis, this extension supports a wide range of ML workflows in image and text domains.
What It Offers
- No-code training workflows for image and text classification
- Use pre-built model nodes for major architecture such as ResNet, LSTM, GRU, Transformer, or create your own model from various model nodes.
- Perform tensor operations like
add,gather,scatter,where, etc. - Support for processing text (e.g. tokenization, embedding) to feed to a model
- Featuring 200 nodes as of March 28, 2025.
Example Workflows
Dog vs. Cat Classifier — No Code Needed
Train an image classifier on your own dataset—entirely in ComfyUI nodes.
ResNet on CIFAR-10
Train a ResNet achieving 94% validation accuracy. A flexible baseline for your own image classification tasks.


Transformer for Text Classification
Train a text classification model using a configurable Transformer model—all node-based.
embedding_transformer_classification.json
Getting Started
- Node Overview: Node Reference
- Model Training Guide: Model Training Documentation
Contributing
This project does not accept pull requests. Unsolicited PRs will be closed without review.
To suggest a feature or report an issue, open an Issue. All issues are reviewed and prioritized.
Node Reference
Every supported node is documented in detail. Browse the Node Reference to explore tensor operations, models, tokenization, distributions, loss functions, tensor operations and more.
Links in the reference section point directly to individual node docs for quick lookup.
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.