EternalKernelPytorchNodes

EternalKernelPytorchNodes
★ 1

PyTorch集成模型训练推理部署CUDA加速
为ComfyUI提供全面的PyTorch节点,涵盖训练、推理与ML工作流,支持CUDA加速、模型层修改、训练可视化与多格式I/O。
💡 在ComfyUI中构建、训练并可视化自定义PyTorch模型。
🍴 1 Forks💻 Python🔄 2025-06-22
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/8b0992d318c3
📦 requirements.txt
#
Core
PyTorch
dependencies
torch>=2.0.0
torchvision>=0.15.0
torchaudio>=2.0.0
#
Essential
ML
dependencies
numpy>=1.24.0
scipy>=1.11.0
scikit-learn>=1.3.0
#
Utility
dependencies
tqdm>=4.64.0
pyyaml>=6.0.0
packaging>=23.1
#
For
configuration
management
coqpit>=0.0.16
#
For
data
handling
h5py
#
Optional
but
commonly
used
transformers>=4.33.0
einops>=0.6.0
📄 README

EternalKernel PyTorch Nodes

[](https://www.gnu.org/licenses/agpl-3.0)

[](https://pytorch.org/)

[](https://www.python.org/)

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

  • 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