Added support for RNN
This commit is contained in:
@@ -162,6 +162,8 @@
|
||||
| [Ptn Max Pool 2d](ptn_max_pool2d.md) | A maxpool layer. |
|
||||
| [Ptn Pre Add Channel Axis](ptn_pre_add_channel_axis.md) | Adds a channel axis after the batch axis if the input is rank 3 (bs, h, w) |
|
||||
| [Ptn Pre Flatten](ptn_pre_flatten.md) | Flattens the input tensor before processing the tensor in the specified model. |
|
||||
| [Ptn RNN](ptn_rnn.md) | A recurrent neural network (RNN) model consisting of one or more of a recurrent layer. |
|
||||
| [Ptn RNN Linear](ptn_rnn_linear.md) | A recurrent neural network (RNN) model with a linear head. |
|
||||
| [Ptn Resnet Model](ptn_resnet_model.md) | A Resnet model consisting of multiple Resnet layers. |
|
||||
## PyTorch wrapper - Optimizer
|
||||
| Node | Description |
|
||||
@@ -226,6 +228,7 @@
|
||||
| [Pt Train Classification Model](pt_train_classification_model.md) | Trains a classification model using a given dataset, optimizer, and number of epochs. |
|
||||
| [Pt Train Classification Model Lr](pt_train_classification_model_lr.md) | Trains a classification model using a given dataset, optimizer, and number of epochs with learning rate decay. |
|
||||
| [Pt Train Model](pt_train_model.md) | Trains a model using a given dataset, loss function, optimizer, and number of epochs with learning rate decay. |
|
||||
| [Pt Train R N N Model](pt_train_rnn_model.md) | Trains an RNN model using a given dataset, loss function, optimizer, and number of epochs with learning rate decay. |
|
||||
| [Pt Train Regression Model](pt_train_regression_model.md) | Trains a regression model using a given dataset, optimizer, and number of epochs. |
|
||||
| [Pto Lr Scheduler Cosine Annealing](pto_lr_scheduler_cosine_annealing.md) | Creates a cosine annealing learning rate scheduler for an optimizer. |
|
||||
| [Pto Lr Scheduler Reduce On Plateau](pto_lr_scheduler_reduce_on_plateau.md) | Creates a reduce-on-plateau learning rate scheduler for an optimizer. |
|
||||
@@ -233,7 +236,9 @@
|
||||
| [Ptv Dataset](ptv_dataset.md) | A Torchvision Dataset class wrapper. |
|
||||
| [Ptv Dataset Len](ptv_dataset_len.md) | A wrapper class that calls Python len on a dataset. |
|
||||
| [Ptv Dataset Loader](ptv_dataset_loader.md) | A node to combine the dataset and data loader into a single node. |
|
||||
| [Ptv Hf Glove Dataset](ptv_hf_glove_dataset.md) | A PyTorch Dataset class wrapper for a Hugging Face dataset that converts text to embedding using Glove. |
|
||||
| [Ptv Image Folder Dataset](ptv_image_folder_dataset.md) | A Torchvision ImageFolder Dataset class wrapper. |
|
||||
| [Ptv Sequential Tensor Dataset](ptv_sequential_tensor_dataset.md) | Creates a sequential tensor Dataset. |
|
||||
| [Ptv Transforms Data Augment](ptv_transforms_data_augment.md) | Applies data augmentation transformations to dataset elements. |
|
||||
| [Ptv Transforms Resize](ptv_transforms_resize.md) | Resizes and transforms elements of dataset to PyTorch tensors. |
|
||||
| [Ptv Transforms To Tensor](ptv_transforms_to_tensor.md) | Transforms elements of dataset to PyTorch tensors. |
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Pt Train R N N Model
|
||||
Trains an RNN model using a given dataset, loss function, optimizer, and number of epochs with learning rate decay.
|
||||
|
||||
Args:
|
||||
model (PTMODEL): The PyTorch model to be trained.
|
||||
linear_head (bool): The RNN model has a Linear head.
|
||||
train_loader (torch.utils.data.DataLoader): DataLoader containing the training dataset.
|
||||
optimizer (PTOPTIMIZER): Optimizer used for training.
|
||||
loss (PTLOSS): The loss class.
|
||||
epochs (int): Number of training epochs.
|
||||
use_gpu (bool): Whether to use GPU for training.
|
||||
early_stopping (bool): Whether to turn on early stopping
|
||||
early_stopping_rounds (int): Specifies the number of rounds to monitor the evaluation loss when early_stopping is enabled and validation data is specified. If the loss does not decrease compared to the current best loss within this period, training will be stopped.
|
||||
output_best_val_model (bool): Whether to outputs the model with the best val loss or the model from the last epoch.
|
||||
classification_metrics (bool): If True and if val_loader is set, print out classification metrics. This is only valid for classification model training.
|
||||
use_valid_token_mean (bool): Computes the mean of the RNN output for non-zero inputs and feeds to the linear layer.
|
||||
val_loader (PTDATALOADER): DataLoader for validation dataset (optional).
|
||||
scheduler (PTLRSCHEDULER): Learning rate scheduler.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| model | Ptmodel |
|
||||
| linear_head | Boolean |
|
||||
| train_loader | Ptdataloader |
|
||||
| optimizer | Ptoptimizer |
|
||||
| loss_function | Ptloss |
|
||||
| epochs | Int |
|
||||
| use_gpu | Boolean |
|
||||
| early_stopping | Boolean |
|
||||
| early_stopping_rounds | Int |
|
||||
| output_best_val_model | Boolean |
|
||||
| classification_metrics | Boolean |
|
||||
| use_valid_token_mean | Boolean |
|
||||
| scheduler | Ptlrscheduler |
|
||||
| val_loader | Ptdataloader |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Ptmodel |
|
||||
| Tensor |
|
||||
| Tensor |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Training
|
||||
|
||||
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,34 @@
|
||||
# Ptn RNN
|
||||
A recurrent neural network (RNN) model consisting of one or more of a recurrent layer.
|
||||
|
||||
Args:
|
||||
input_size (int): The number of input features.
|
||||
hidden_size (int): The number of output features of the hidden layer matrix.
|
||||
num_layers (int): Number of hidden layers.
|
||||
nonlinearity (str): Activation function to apply after each hidden layer. Specify 'tanh' or 'relu'.
|
||||
bias (bool): Use bias or not.
|
||||
batch_first (bool): Indicates the shape of the input. Input is assumed to be a rank-3 tensor. If True, the shape is [Batch, Seq, Token]. If False, the shape is [Seq, Batch, Token]. Note that default is set to `True` unlike PyTorch's RNN default model parameter.
|
||||
dropout (float): Dropout probability to be applied to the output of intermediate layers if non-zero. This will not be applied to the last layer's output.
|
||||
bidirectional (bool): Processes the input in a backward direction and append the result to the output of the forward direction.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| input_size | Int |
|
||||
| hidden_size | Int |
|
||||
| num_layers | Int |
|
||||
| nonlinearity | |
|
||||
| bias | Boolean |
|
||||
| batch_first | Boolean |
|
||||
| dropout | Float |
|
||||
| bidirectional | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Ptmodel |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Model
|
||||
|
||||
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Ptn RNN Linear
|
||||
A recurrent neural network (RNN) model with a linear head.
|
||||
|
||||
Args:
|
||||
input_size (int): The number of input features.
|
||||
hidden_size (int): The number of output features of the hidden layer matrix.
|
||||
num_layers (int): Number of hidden layers in RNN.
|
||||
nonlinearity (str): Activation function to apply after each hidden layer. Specify 'tanh' or 'relu'.
|
||||
bias (bool): Use bias or not.
|
||||
batch_first (bool): Indicates the shape of the input. Input is assumed to be a rank-3 tensor. If True, the shape is [Batch, Seq, Token]. If False, the shape is [Seq, Batch, Token]. Note that default is set to `True` unlike PyTorch's RNN default model parameter.
|
||||
dropout (float): Dropout probability to be applied to the output of intermediate layers if non-zero. This will not be applied to the last layer's output.
|
||||
bidirectional (bool): Processes the input in a backward direction and append the result to the output of the forward direction.
|
||||
linear_output_size (int): The number of output features of the linear layer.
|
||||
linar_bias (bool): Use bias or not in linear layer.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| input_size | Int |
|
||||
| hidden_size | Int |
|
||||
| num_layers | Int |
|
||||
| nonlinearity | |
|
||||
| bias | Boolean |
|
||||
| batch_first | Boolean |
|
||||
| dropout | Float |
|
||||
| bidirectional | Boolean |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Ptmodel |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Model
|
||||
|
||||
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,30 @@
|
||||
# Ptv Hf Glove Dataset
|
||||
A PyTorch Dataset class wrapper for a Hugging Face dataset that converts text to embedding using Glove.
|
||||
|
||||
Args:
|
||||
name (str): Name of the dataset class (e.g., MNIST, FashionMNIST).
|
||||
split (str): The name of the subset of dataset to retrieve or the split specifier.
|
||||
embed_dim (int): Embedding dimension for Glove.
|
||||
max_seq_len (int): Sequence length.
|
||||
sample_field_name (str): Field name for text samples.
|
||||
label_field_name (str): Field name for labels.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| name | String |
|
||||
| split | String |
|
||||
| embed_dim | Int |
|
||||
| max_seq_len | Int |
|
||||
| sample_field_name | String |
|
||||
| label_field_name | String |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Ptvdataset |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Training
|
||||
|
||||
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Ptv Sequential Tensor Dataset
|
||||
Creates a sequential tensor Dataset.
|
||||
|
||||
Args:
|
||||
tens (torch.Tensor): The tensor containing the data.
|
||||
seq_len (int): Sequence length.
|
||||
|
||||
## Input
|
||||
| Name | Data type |
|
||||
|---|---|
|
||||
| tens | Tensor |
|
||||
| seq_len | Int |
|
||||
|
||||
## Output
|
||||
| Data type |
|
||||
|---|
|
||||
| Ptvdataset |
|
||||
|
||||
<HR>
|
||||
Category: PyTorch wrapper - Training
|
||||
|
||||
ComfyUI Pt Wrapper Node Reference. © 2025 Hide Inada (HowToSD.com). All rights reserved.
|
||||
Reference in New Issue
Block a user