EternalKernel PyTorch Nodes
Comprehensive PyTorch nodes for ComfyUI - Neural network training, inference, and ML workflows
Nodes (35)
Stick a ReLU (or any activation) on the end of your PyTorch model without leaving the graph
Stop fighting vanishing gradients, let the batch norm handle it
Putting real convolutional layers into your ComfyUI-built PyTorch model
The cheap regularizer your ComfyUI-built model is probably missing
The workhorse that stacks fully-connected layers in your ComfyUI model
Glue two Sequential models together end-to-end in ComfyUI
Put a reshape inside the model instead of praying the shapes line up
Turn raw model outputs into probabilities in ComfyUI
Bolt an actual attention layer onto your ComfyUI model
The dtype converter for when your tensor doesn't match your model
The adapter that hands ComfyUI images to your PyTorch nodes
Wrap your dataset in a DataLoader, and know what that buys you
Carve an 80/20 train/validation split out of your dataset
Slice a sub-network out of your model, frozen or not
Flatten your whole dataset's pixels in one move (with a catch)
The one-node trick that keeps shape mismatches out of your models
It looks like a Python executor. It is not. Read this before you use it.
Auto-try every hyperparameter combo — then double-check the 'best' it picks
Turn plain Python lists into real PyTorch tensors
The node that loads an entire Lumina-DiMOO stack at once
Pull a saved .pt tensor back into your ComfyUI graph
Turn a column of numbers into a chart you can actually look at
The dataset faucet — though it really only does MNIST
Run a trained network on real data (one sample at a time)
Move a model or tensor between CUDA and CPU
Synthetic data on tap for testing a graph that has no data yet
Change a tensor's shape without touching its values
The worst-named node in the pack — it saves nothing
Persist a tensor to disk so you don't regenerate it every run
The empty canvas every network in this pack starts on
Freeze or unfreeze an entire model with one dropdown
Take the first N rows of a tensor when you only need a chunk
Two tensors walk into a node and come out a labeled dataset
Drop a tensor into plain Python so you can finally see it
The whole training loop, in a single node — no Python required
EternalKernel PyTorch Nodes
A comprehensive collection of PyTorch nodes for ComfyUI, enabling advanced machine learning workflows with neural network training, inference, and data manipulation capabilities.
🌟 Features
🧠 Neural Network Components
- Layer Nodes: Linear, Convolutional, BatchNorm, Dropout, Transformer layers
- Activation Functions: ReLU, Sigmoid, Tanh, Softmax, and more
- Model Building: Sequential model construction and layer extraction
- Architecture Tools: Reshape, flatten, and tensor manipulation utilities
🚀 Training & Inference
- Model Training: Full training loops with loss computation and optimization
- Grid Search: Automated hyperparameter optimization
- Inference: Efficient model inference with GPU acceleration
- Model Management: Save/load PyTorch models with metadata
📊 Data Handling
- Dataset Tools: Download popular datasets (MNIST, CIFAR, etc.)
- Data Processing: Split, shuffle, and batch your datasets
- Tensor Operations: Slice, reshape, type conversion, and device management
- ComfyUI Integration: Convert between ComfyUI images and PyTorch tensors
🔧 Advanced Features
- GPU Support: Automatic CUDA acceleration when available
- Model Modification: Extract layers, freeze/unfreeze parameters
- Visualization: Plot training metrics and data distributions
- Flexible I/O: Support for various data formats and tensor types
📦 Installation
Quick Start
- Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes
- Clone this repository:
git clone https://github.com/TashaSkyUp/EternalKernelPyTorchNodes.git
- Install dependencies:
cd EternalKernelPyTorchNodes
pip install -r requirements.txt
- Restart ComfyUI and the nodes will appear under the ETK/pytorch category.
Requirements
- Python: 3.8 or higher
- PyTorch: 2.0+ (with CUDA support recommended)
- ComfyUI: Latest version
- Dependencies: See
requirements.txtfor full list
🎯 Node Categories
Dataset & Data Processing
PyTorchDatasetDownloader- Download popular ML datasetsDatasetSplitter- Split datasets into train/test/validationTensorsToDataset- Create datasets from tensor collectionsDatasetToDataloader- Generate DataLoaders with batching
Neural Network Layers
AddLinearLayerNode- Fully connected layersAddConvLayer- Convolutional layers with customizable parametersAddBatchNormLayer- Batch normalization for stable trainingAddDropoutLayer- Regularization through dropoutAddTransformerLayer- Modern attention-based layersAddReshapeLayer- Dynamic tensor reshaping
Model Operations
SequentialModelProvider- Build sequential neural networksPyTorchInferenceNode- Run inference on trained modelsTrainModel- Complete training loops with optimizationGridSearchTraining- Automated hyperparameter tuningSaveModel/LoadModel- Model persistence with metadata
Tensor Utilities
FlattenTensor- Flatten multi-dimensional tensorsReshapeTensor- Reshape tensors to desired dimensionsSliceTensor- Extract tensor slices and subsetsChangeTensorType- Convert between tensor data typesPyTorchToDevice- Move tensors between CPU/GPURandomTensor- Generate random tensors for testing
Advanced Tools
ExtractLayersAsModel- Extract sublayers as standalone modelsAddModelAsLayer- Embed existing models as layersSetModelTrainable- Freeze/unfreeze model parametersFuncModifyModel- Apply custom functions to modelsPlotSeriesString- Visualize training metrics
🚀 Usage Examples
Basic Neural Network Training
Create and train a neural network with just a few nodes:
- Download Dataset → Split Data → Build Model → Train → Save
Grid Search Optimization
Automatically find the best hyperparameters for your model with the GridSearchTraining node.
ComfyUI Integration
Seamlessly convert between ComfyUI images and PyTorch tensors for ML processing in your workflows.
🧪 Testing
Run the comprehensive test suite:
cd EternalKernelPyTorchNodes
python -m pytest tests/ -v
Tests cover all node functionality, model training/inference, tensor operations, and GPU/CPU compatibility.
🤝 Contributing
Contributions welcome! Please:
- Report bugs or issues
- Suggest new features
- Submit pull requests
- Improve documentation
📋 Compatibility
- ComfyUI: All recent versions
- OS: Windows, macOS, Linux
- Hardware: CPU and CUDA GPUs
- PyTorch: 2.0+ (optimized for latest)
📄 License
GNU Affero General Public License v3.0 - see LICENSE file for details.
🙏 Acknowledgments
Built for the ComfyUI community, powered by PyTorch.
Made with ❤️ for the ComfyUI and PyTorch communities
For support: GitHub Issues