Extensions/EternalKernel PyTorch Nodes
ComfyUI Extension

EternalKernel PyTorch Nodes

Comprehensive PyTorch nodes for ComfyUI - Neural network training, inference, and ML workflows

By TashaSkyUp·Created about a year ago·Updated about a year ago· 1
TashaSkyUp/EternalKernelPytorchNodes
Nodes35
On cloudLocal install
CategoryETK/pytorch
Stars1
Updatedabout a year ago

Nodes (35)

Activation

Stick a ReLU (or any activation) on the end of your PyTorch model without leaving the graph

ETK/pytorch
AddBatchNormLayer

Stop fighting vanishing gradients, let the batch norm handle it

ETK/pytorch
AddConvLayer

Putting real convolutional layers into your ComfyUI-built PyTorch model

ETK/pytorch
AddDropoutLayer

The cheap regularizer your ComfyUI-built model is probably missing

ETK/pytorch
AddLinearLayerNode

The workhorse that stacks fully-connected layers in your ComfyUI model

ETK/pytorch
AddModelAsLayer

Glue two Sequential models together end-to-end in ComfyUI

ETK/pytorch
AddReshapeLayer

Put a reshape inside the model instead of praying the shapes line up

ETK/pytorch
AddSoftmaxLayerNode

Turn raw model outputs into probabilities in ComfyUI

ETK/pytorch
AddTransformerLayer

Bolt an actual attention layer onto your ComfyUI model

ETK/pytorch
ChangeTensorType

The dtype converter for when your tensor doesn't match your model

ETK/pytorch
ComfyUIImageToPytorchTENSOR

The adapter that hands ComfyUI images to your PyTorch nodes

ETK/pytorch
DatasetToDataloader

Wrap your dataset in a DataLoader, and know what that buys you

ETK/pytorch
DatsetSplitter

Carve an 80/20 train/validation split out of your dataset

ETK/pytorch
ExtractLayersAsModel

Slice a sub-network out of your model, frozen or not

ETK/pytorch
FlattenDataset

Flatten your whole dataset's pixels in one move (with a catch)

ETK/pytorch
FlattenTensor

The one-node trick that keeps shape mismatches out of your models

ETK/pytorch
FuncModifyModel

It looks like a Python executor. It is not. Read this before you use it.

ETK/pytorch
GridSearchTraining

Auto-try every hyperparameter combo — then double-check the 'best' it picks

ETK/pytorch
ListToTensor

Turn plain Python lists into real PyTorch tensors

ETK/pytorch
LoadModel

The node that loads an entire Lumina-DiMOO stack at once

ETK/pytorch
LoadTorchTensor

Pull a saved .pt tensor back into your ComfyUI graph

ETK/pytorch
PlotSeriesString

Turn a column of numbers into a chart you can actually look at

ETK/pytorch
PyTorchDatasetDownloader

The dataset faucet — though it really only does MNIST

ETK/pytorch
PyTorchInferenceNode

Run a trained network on real data (one sample at a time)

ETK/pytorch
PyTorchToDevice

Move a model or tensor between CUDA and CPU

ETK/pytorch
RandomTensor

Synthetic data on tap for testing a graph that has no data yet

ETK/pytorch
ReshapeTensor

Change a tensor's shape without touching its values

ETK/pytorch
SaveModel

The worst-named node in the pack — it saves nothing

ETK/pytorch
SaveTorchTensor

Persist a tensor to disk so you don't regenerate it every run

ETK/pytorch
SequentialModelProvider

The empty canvas every network in this pack starts on

ETK/pytorch
SetModelTrainable

Freeze or unfreeze an entire model with one dropdown

ETK/pytorch
SliceTensor

Take the first N rows of a tensor when you only need a chunk

ETK/pytorch
TensorsToDataset

Two tensors walk into a node and come out a labeled dataset

ETK/pytorch
TensorToList

Drop a tensor into plain Python so you can finally see it

ETK/pytorch
TrainModel

The whole training loop, in a single node — no Python required

ETK/pytorch
Readme

EternalKernel PyTorch Nodes

License: AGPL-3.0 PyTorch Python

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

  1. Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes
  1. Clone this repository:
git clone https://github.com/TashaSkyUp/EternalKernelPyTorchNodes.git
  1. Install dependencies:
cd EternalKernelPyTorchNodes
pip install -r requirements.txt
  1. 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.txt for full list

🎯 Node Categories

Dataset & Data Processing

  • PyTorchDatasetDownloader - Download popular ML datasets
  • DatasetSplitter - Split datasets into train/test/validation
  • TensorsToDataset - Create datasets from tensor collections
  • DatasetToDataloader - Generate DataLoaders with batching

Neural Network Layers

  • AddLinearLayerNode - Fully connected layers
  • AddConvLayer - Convolutional layers with customizable parameters
  • AddBatchNormLayer - Batch normalization for stable training
  • AddDropoutLayer - Regularization through dropout
  • AddTransformerLayer - Modern attention-based layers
  • AddReshapeLayer - Dynamic tensor reshaping

Model Operations

  • SequentialModelProvider - Build sequential neural networks
  • PyTorchInferenceNode - Run inference on trained models
  • TrainModel - Complete training loops with optimization
  • GridSearchTraining - Automated hyperparameter tuning
  • SaveModel / LoadModel - Model persistence with metadata

Tensor Utilities

  • FlattenTensor - Flatten multi-dimensional tensors
  • ReshapeTensor - Reshape tensors to desired dimensions
  • SliceTensor - Extract tensor slices and subsets
  • ChangeTensorType - Convert between tensor data types
  • PyTorchToDevice - Move tensors between CPU/GPU
  • RandomTensor - Generate random tensors for testing

Advanced Tools

  • ExtractLayersAsModel - Extract sublayers as standalone models
  • AddModelAsLayer - Embed existing models as layers
  • SetModelTrainable - Freeze/unfreeze model parameters
  • FuncModifyModel - Apply custom functions to models
  • PlotSeriesString - Visualize training metrics

🚀 Usage Examples

Basic Neural Network Training

Create and train a neural network with just a few nodes:

  1. Download DatasetSplit DataBuild ModelTrainSave

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