ComfyUI Extension: EternalKernel PyTorch Nodes

Authored by TashaSkyUp

Created

Updated

0 stars

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

Custom Nodes (0)

    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 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