ComfyUI Extension: EternalKernel PyTorch Nodes
Comprehensive PyTorch nodes for ComfyUI - Neural network training, inference, and ML workflows
Custom Nodes (0)
README
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.txt
for 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