6,119 questions
0
votes
1
answer
118
views
Why does a LSTM pytorch model yield constant values?
I am training a LSTM model with data from yfinance. The process is really standard. I get the data with yf.download(ticker=ticker) where ticker='AAPL and do df.rolling(30, min_periods=1) to smooth the ...
3
votes
0
answers
77
views
Multimodel for image captioning with CNN and LSTM over flickr30k does not learn. How to fuse image features and word embeddings?
I'm working on an image captioning project using a simple CNN + LSTM architecture, as required by the course I'm studying. The full code is available here on GitHub (note: some parts are memory-...
0
votes
0
answers
34
views
AWS Sagemaker invoke endpoint error "Could not find variable lstm_model/dense/bias"
I have trained a model and deployed as endpoint using aws sagemaker and when I tried to invoke I have got error:
2025-09-09 14:58:25.724914: I external/org_tensorflow/tensorflow/core/framework/...
0
votes
0
answers
23
views
AttributeError: the layer convolutional_Bidirectional_LSTM has never been called and thus has no defined input
I have 3 models and I want to create a hybrid model with these. I put my first models when I want to call the input of this I get an error.
This is my code:
def memory_model(input_shape, num_class, ...
0
votes
1
answer
47
views
Ram Memory leak when scripting a Sampling Trainer for a Bert Encoder and LSTM Decoder Tensorflow on GPU
I wrote the module attached below. However, I notice a constant increase of RAM until I get an out of memory error. The code runs on CPU without a problem (except the slow training time). It can ...
0
votes
0
answers
60
views
RL Trading Agent Can't Learn Sensible Behavior Even on a Simple Sine Wave — What Am I Doing Wrong?
I’ve been building a reinforcement learning trading agent using a synthetic sine wave as the price series — basically the simplest dataset I could imagine to test whether an agent can learn to buy low ...
2
votes
1
answer
94
views
Error forming mini-batch for network input
I am trying to predict vehicle trajectory, using t-30 data sequence to predict until t+30 trajectory. The data I have created is an neighbour occupancy matrix for each frames for each cars, this data ...
0
votes
0
answers
75
views
Lstmtraining Tesseract-OCR
I followed the steps for fine-tuning Tesseract for handwriting recognition. I have the character images and the corresponding box files. Then I generated the .lstmf files, followed by the lstm_train....
0
votes
0
answers
22
views
LSTM controller for three phase inverter
I want to use the LSTM network as a controller of a three-phase inverter.
The lstm controller will have six inputs, 3 sinuocidal voltage signals and 3 sinuocidal current signals (400 Hz). The lstm ...
0
votes
1
answer
37
views
LSTM model produces single output for full batch of training data
My training set has dimensions [7000, 2], but my output has single number in it. I want to configure the model to understand that "I want one output for each row in X_train", but I don't ...
0
votes
1
answer
76
views
Why does my LSTM model raise max_seq_length <= 0 when predicting with new input of same shape?
I'm training a multi-branch LSTM model on Kaggle using 2x T4 GPUs, with multiple input sequences of different lengths. My target is the "close" column.
1. Normalization and Data:
I normalize ...
0
votes
0
answers
123
views
snpe-pytorch-to-dlc tries to duplicate LSTM model weights for each sample in the input window which crashes for large window sizes
I am trying to convert pytorch LSTM model to DLC. The original pytorch model is of 200 MB. I also converted it to traced TorchScript model, scripted TorchScript model and ONNX model. All three are of ...
-1
votes
1
answer
45
views
Stock Market Hybrid Model -LSTM & Random Forest
I am working on a market risk assessment involving a hybrid of LSTM and Random Forest. This post might seem dumb , but I am really struggling with the model right now , here are my struggles in the ...
0
votes
1
answer
47
views
Can Tensorflow or PyTorch work with json time series data in this format?
I'm trying to make a LSTM model to predict sign language sentence with this format of json file. This json file is containing the coordinates information of 21 hand landmark joints for each frames and ...
0
votes
0
answers
82
views
Deploying an LSTM Model App on Streamlist Cloud
I am deploying an app that is using an LSTM Model saved as .h5. It worked perfectly locally, but while deploying on the Streamlit Cloud, it gives the this error:
ValueError: Unrecognized keyword ...
0
votes
0
answers
52
views
How does an LSTM layer interface with a fully connected layer?
I am unclear how an LSTM layer would interface with a fully connected layer and what this would look like visually as per the puthon code below. I am trying to understand and visualize this code.
I'm ...
1
vote
0
answers
37
views
Multivariate Time Series Modelling with GRU
we have 300 stores in a retail demand forecasting problem and we have 1 years of daily demand data, for some stores shorter. Using GRU to also model the extreme cases but the problem is how to feed ...
1
vote
1
answer
86
views
Jax / Flax potential tracing issue
I'm currently using Flax for neural network implementations. My model takes two inputs:
x and θ. It first processes x through an LSTM, then concatenates the LSTM's output with θ — or more precisely, ...
1
vote
1
answer
342
views
RuntimeError: Given groups=1, weight of size [64, 3, 3, 7, 7], expected input[1, 8, 3, 112, 112] to have 3 channels, but got 8 channels instead
import os
import shutil
import random
import torch
import torchvision.transforms as transforms
import cv2
import numpy as np
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
...
0
votes
0
answers
73
views
pytorch after load model state_dict training loss keep increasing
Im training a model and in the first training, no matter how many epochs (10,20,30…) i trained the model, everything looks great! the acc was increasing and the loss was decreasing as well. but when i ...
0
votes
1
answer
39
views
Train LSTM for time series with varying lengths
I'm training a LSTM for time series prediction, where data comes from sensors at irregular intervals. I'm using the last 5 min data to predict the next value, but some sequences are larger than others....
0
votes
0
answers
96
views
How to Perform Out-of-Sample Forecast for a Hybrid VAR-LSTM Model?
I have built a hybrid model that combines a Vector Autoregressive (VAR) model and a Long Short-Term Memory (LSTM) network. The VAR model is used to capture linear dependencies between macroeconomic ...
0
votes
0
answers
54
views
Pytorch LSTM-VAE not able to learn
I have some problem to make a LSTM-VAE for anomalies detection on multivariate signals (no constant duration). I found some informations in this forum and original papers to apply good practices. Even,...
0
votes
0
answers
62
views
Very slow Evaluation of a Pytorch LSTM model
I'm experiencing some issues with an LSTM model designed to perform "Audio Event Recognition" from a dataset of crime-related audio samples.
The overall network seems to be working fine ...
0
votes
1
answer
71
views
Underfitting Pre-Trained Glove + LSTM Model: Accurcacy Unchanged [closed]
I am doing a sentiment classification using Pre-Trained Glove and LSTM model. I use google play review and scrap it by myself, resulting in 50k++ texts. I implement random over sampling on the ...
0
votes
1
answer
120
views
Using a symbolic `tf.Tensor` as a Python `bool` is not allowed
when I add a masking layer in my model, it gives this error. works fine without the masking tho. If anyone can solve this, id be grateful ! been scratching my head for 3 days now.
TensorFlow 2.17
def ...
1
vote
1
answer
115
views
How to prevent certain input from impacting certain output of neural networks in pytorch?
I have an LSTM model that receives 5 inputs to predict 3 outputs:
import torch
import torch.nn as nn
class LstmModel(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
...
1
vote
0
answers
32
views
Predicting the same class (normal) when I use LSTM as a classifier for time series data
LSTM for the binary classification.
Hi all,
I am using LSTM to perform binary classification on time series data (normal, abnormal). I trained two models, one using a single LSTM layer and another ...
0
votes
1
answer
35
views
Troubleshooting LSTM Forecasting Function: What am I doing wrong?
I have three inputs to my LSTM (x,y,z). My LSTM model is used to predict the next time step of z. I have a lookback period of 9 timesteps. I then need to forecast the next time steps of z using a ...
0
votes
1
answer
39
views
LSTM autoencoder very poor results
I am working on blockchain transaction anomaly detection system and testing various models. Currently I am stuck on a LSTM autoencoder. I have preprocessed transaction data from ethereum network (used ...
0
votes
1
answer
59
views
Loss and accuracy curves with spikes? [closed]
I'm currently working with CNN, LSTM, and BiLSTM as a hybrid algorithm, and these are the results I got for the accuracy and loss curves for the training and test sets. The issue is that I do not know ...
0
votes
0
answers
267
views
Tensorflow.Net: How to load a Sequential model saved by model.Save()?
I am just starting off with Tensorflow.Net (0.150.0) on .Net (8.0). I just created a basic sequential model and saved it successfully. However, I am unable to load it back as a Sequential model. I ...
1
vote
1
answer
121
views
autoencoder.fit() raises 'KeyError: 'Exception encountered when calling Functional.call()'
I'm trying to build a stacked LSTM sequence auto-encoder that takes a signal of 430 timesteps with each timestep having 1 value. You can see the code for the model below:
feat_dim = 1
timesteps = 430
...
0
votes
0
answers
125
views
LSTM model prediction does not change with different inputs
I am implementing in PyTorch an LSTM model to predict if the closing value of a stock will go up or down in the next 5 and 10 minutes.
Specifically, I am using 24 years of 5 minute data with 19 ...
0
votes
0
answers
74
views
Invalid input shape for input Tensor("sequential_1/Cast:0", shape=(None, 30), dtype=float32)
I wrote:
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import tensorflow as tf
from keras.models import Sequential
from keras.layers import ...
0
votes
0
answers
31
views
How to Build a Neural Network for Predicting Loan Status Using Multi-Table Data from the Berka Dataset
I am working on a project using the Berka dataset, and I want to build a neural network to predict the loan status for accounts. The dataset contains multiple tables, and I want to avoid flattening ...
0
votes
0
answers
24
views
Forward pass of RecurrentPPO algorithm not producing the right shaped tensor
I am performing a forward pass for RecurrentPPO algorithm (part of sb3-contrib) library. The policy used is the MlpLstmPolicy. I have 3 action classes. Hence ideally the action_logits returned have to ...
0
votes
0
answers
39
views
What is the possible enhancement for this mode?
I use LSTM for classifying multi-label movie genres with Word2Vec as feature extraction; the model resulted in metrics as Test Loss: 0.3067, Test Accuracy: 0.5144 as illustrated in the figure.
What is ...
2
votes
0
answers
34
views
LSTM stuck on image generation
I created an LSTM for generating next image in a sequence (I know CNN is for image generation but I need the entire image not just the filters to give to the next iteration of the sequence). So I have ...
1
vote
1
answer
400
views
jax and flax not playing nicely with each other
I want to implement a neural network with multiple LSTM gates stacked one after the other.I set the hidden states to 0, as suggested here. When I try to run the code, I get
JaxTransformError: Jax ...
0
votes
0
answers
29
views
Prediction Errors with Time Series Forecasting - LSTM
Review of the Time Series Prediction Code
In this project, we aim to predict consumption values using a Long Short-Term Memory (LSTM) model based on historical data. Below is a breakdown of the ...
0
votes
0
answers
22
views
LSTM training fades to Nan when batch_number>=2
I am running a very simple multilayer LSTM network. I have set different transformations for the data, namely StandardScaler(), RobustScaler() and MinMaxScaler(). The code runs smooth and I get no ...
0
votes
1
answer
32
views
How can I fix this error : ValueError: X has 1 features, but MinMaxScaler is expecting 4 features as input [closed]
I am a beginner in programming and currently working on an assignment about predicting gold prices. I am stuck on the final part of the code, specifically the part that predicts the gold price for the ...
0
votes
0
answers
65
views
How to implement a custom LSTM cell in PyTorch
I am trying to build a custom LSTM cell. I found many snippets online but none of them produces same result as torch lstm. For testing, I fix input size and number of layers to 1. Is there a known way ...
1
vote
0
answers
181
views
I am having trouble using LSTM layers in Tensorflow.Net
I am currently trying to build a model for my project. I have to build a LSTM-CNN neural network for my tensor data. I have read the documents about tensorflow.net however, LSTM layers are not ...
0
votes
0
answers
230
views
PyTorch LSTM regression: Take only last output value or take all output values of LSTM?
I try to train my first LSTM regression model based on global average temperature data. The temperature is available for every month since January 1st, 1850.
From what I've learned online, I feed 12 ...
0
votes
1
answer
318
views
Using tensorflow through Keras - ValueError: Only input tensors may be passed as positional arguments
I am trying to get keras_model_sequential to work in R:
library(tidyverse)
library(keras)
model <- keras_model_sequential(input_shape = c(8))
model %>%
layer_dense(units = 32) %>%
...
1
vote
1
answer
137
views
Multiple Multivariate Time series forecasting with LSTM along with some categorical features
Currently I am working on a timeseries data which looks like this
click to see data
The data consists of 5 companies, 15 products (each company has 3-5 products) and 6 different regions
Goal To build ...
0
votes
1
answer
48
views
Why can't my LSTM determine if a sequence is odd or even in the number of ones?
I am trying to understand LSTMs and wanted to implement a simple example of classifying a sequence as "0" if the number of "1" in the sequence is odd and as "1" if the ...
0
votes
1
answer
154
views
torch.autograd.grad is returning `None` when calculating derivative wrt time
I have an LSTM model that takes 3 sequences of temperature data and outputs the next sequence.
input => [array([0.20408163, 0.40816327, 0.6122449 ]),
array([0.40816327, 0.6122449 , 0....