Spaces:
Running
Running
Rename pages/19_RNN_Shakespeare.py to pages/19_RNN_LSTM_Shakespeare.py
Browse files
pages/{19_RNN_Shakespeare.py → 19_RNN_LSTM_Shakespeare.py}
RENAMED
|
@@ -94,8 +94,8 @@ if st.button("Train and Generate"):
|
|
| 94 |
targets = Y_tensor[i].unsqueeze(0)
|
| 95 |
|
| 96 |
# Forward pass
|
| 97 |
-
outputs, h = model(inputs, h)
|
| 98 |
-
h = (h[0].detach(), h[1].detach())
|
| 99 |
loss = criterion(outputs, targets)
|
| 100 |
|
| 101 |
# Backward pass and optimization
|
|
|
|
| 94 |
targets = Y_tensor[i].unsqueeze(0)
|
| 95 |
|
| 96 |
# Forward pass
|
| 97 |
+
outputs, h = model(inputs, (h[0].squeeze(1), h[1].squeeze(1)))
|
| 98 |
+
h = (h[0].detach().unsqueeze(1), h[1].detach().unsqueeze(1))
|
| 99 |
loss = criterion(outputs, targets)
|
| 100 |
|
| 101 |
# Backward pass and optimization
|