pytorch-chatbot
pytorch-chatbot copied to clipboard
TypeError: linear(): argument 'input' (position 1) must be Tensor, not ReLU
I've made it to 12:54 in the 3rd part of his series, and I have come to a roadblock in the code. I cannot find a way to work around it. Any advice or potential fixes help. Thanks!
Output
[nltk_data] Downloading package punkt to
[nltk_data] C:\Users\AlienUser\AppData\Roaming\nltk_data...
[nltk_data] Package punkt is already up-to-date!
Traceback (most recent call last):
File "c:\Users\AlienUser\Documents\PyTorchBot\train.py", line 85, in
Link to Video: https://www.youtube.com/watch?v=Da-iHgrmHYg
Can you share your model.py
code? Maybe there is some problem in it.
import torch import torch.nn as nn
class YourModel(nn.Module): def init(self, input_size, hidden_size, output_size): super(YourModel, self).init() self.l1 = nn.Linear(input_size, hidden_size) self.relu = nn.ReLU() # ReLU activation function self.l2 = nn.Linear(hidden_size, output_size)
def forward(self, x):
out = self.l1(x)
out = self.relu(out) # Apply ReLU activation
out = self.l2(out)
return out
Create an instance of your model
model = YourModel(input_size, hidden_size, output_size)
Assuming 'words' is your input tensor
outputs = model(words)