All Questions

Tagged with
Filter by
Sorted by
Tagged with
10 votes
1 answer
5k views

CUDNN_STATUS_BAD_PARAM when trying to perform inference on a LSTM Seq2Seq with masked inputs

I'm using keras layers on tensorflow 2.0 to build a simple LSTM-based Seq2Seq model for text generation. versions I'm using: Python 3.6.9, Tensorflow 2.0.0, CUDA 10.0, CUDNN 7.6.1, Nvidia driver ...
Felipe's user avatar
  • 11.8k
7 votes
0 answers
1k views

Entity Embedding of Categorical within Time Series Data and LSTM

I'm trying to solve a time series problem. In short, for each customer and material (SKU code), I have different orders placed in the past. I need to build a model that predict the number of days ...
Andrea Barral's user avatar
4 votes
1 answer
3k views

add LSTM/GRU to BERT embeddings in keras tensorflow

I am experimenting with BERT embeddings following this code https://github.com/strongio/keras-bert/blob/master/keras-bert.py These are the important bits of the code (lines 265-267): bert_output = ...
daria's user avatar
  • 101
4 votes
2 answers
1k views

What does Keras do with the initial values of cell & hidden states (RNN, LSTM) for inference?

Assuming training is finished: what values does Keras use for the 0th cell state and hidden states at inference (in LSTM and RNN layers)? I could think of at least three scenarios, and could not find ...
Jonn Dove's user avatar
  • 487
3 votes
2 answers
379 views

Does model.reset_states for LSTM affect any other non-LSTM layers in the model?

I am using the Stateful mode of LSTMs in tf.keras where I need to manually do reset_states when I have processed my sequence data, as described here. It seems that normally people do model....
adamconkey's user avatar
  • 4,414
3 votes
1 answer
241 views

InvalidArgumentError on Decoder Model during Inference, for LSTM-based Seq2Seq on Tensorflow 2.0

versions: Python 3.6.9, Tensorflow 2.0.0, CUDA 10.0, CUDNN 7.6.1, Nvidia driver version 410.78. I'm trying to port a LSTM-based Seq2Seq tf.keras model to tensorflow 2.0 Right now I'm facing the ...
Felipe's user avatar
  • 11.8k
3 votes
0 answers
894 views

LSTM for imbalanced time series classification

I wanted to fit simple LSTM model to perform binary classification on multivariate time series data. Since my data is severely imbalanced, I have integrated class_weight argument from sklearn in my ...
ForestGump's user avatar
3 votes
2 answers
2k views

LSTM - Use deltaTime as a feature? How to handle irregular timestamps?

I'm trying to create a LSTM for classification of data sequences. The data structure of every training input that I would use is: [[ [deltaX,deltaY,deltaTime], [deltaX,deltaY,deltaTime],... ],class] ...
devnull's user avatar
  • 430
2 votes
2 answers
5k views

error Node: 'binary_crossentropy/Cast' Cast string to float is not supported while train model

i want to train my data i already make my data to string with word2vec pretrain model from here https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.id.300.vec.gz and success to make a model, but ...
nikko's user avatar
  • 35
2 votes
1 answer
862 views

What is the connections between two stacked LSTM layers?

The question is like this one What's the input of each LSTM layer in a stacked LSTM network?, but more into implementing details. For simplicity how about 4 units and 2 units structures like the ...
sikisis's user avatar
  • 468
2 votes
1 answer
722 views

Pad vectors in tf.keras for LSTM

Keras has a preprocessing util to pad sequences, but it assumes that the sequences are integer numbers. My sequences are vectors (my own embeddings, I do not want to use Keras embeddings), is there ...
Trylks's user avatar
  • 1,478
2 votes
0 answers
319 views

How to freeze tensorflow variables inside tf.keras framework on eager execution mode?

I'm trying to fine tune the input weights in a recurrent cell without letting the backpropagation affect previous states (kind of truncated backpropagation with n = 1). I'm using tf.keras and eager ...
Pablo Brusco's user avatar
1 vote
2 answers
1k views

Confused about how to combine CONV1D and LSTM

I am struggling to understand this code which combines both CONV1D and LSTM. model = tf.keras.models.Sequential([ tf.keras.layers.Conv1D(filters=32, kernel_size=5, strides=1, ...
bravopapa's user avatar
  • 425
1 vote
1 answer
636 views

Dense vs. TimeDistributed(Dense)

Is there any difference between this two methods of using Dense layer? Seems output shape is the same and number of parameters is the same. Will be the output the same if we use fixed weights? Will ...
mrgloom's user avatar
  • 20.8k
1 vote
1 answer
82 views

N timeseries feed to one layer with N lstm cells, how to concatenate lstm horizontally as a layer?

I am trying to impliment https://dl.acm.org/doi/pdf/10.1145/3269206.3271794 . It has a network structure like timeseries1 -> lstm1 timeseries2 -> lstm2 .... timeseriesN -> lstmN [lstm1, ...
user avatar
1 vote
1 answer
241 views

Meaning of 2D input in Keras LSTM

In Keras, LSTM is in the shape of [batch, timesteps, feature]. What if I indicate the input as keras.Input(shape=(20, 1)) and feed a matrix of (100, 20, 1) as input? What's the number of batch that it'...
Josh's user avatar
  • 53
1 vote
1 answer
121 views

Logits and labels must be broadcastable: logits_size=[29040,3] labels_size=[290400,3]

I am using this code: import tensorflow as tf import numpy as np from tensorflow.keras.layers import Dense, LSTM, Input, Conv2D, Lambda from tensorflow.keras import Model def reshape_n(x): x = tf....
George's user avatar
  • 5,511
1 vote
1 answer
736 views

Validation accuracy zero and Loss is higher. Intent classification Using LSTM

I'm trying to Build and LSTM model for intent classification using Tensorflow, Keras. But whenever I'm training the model with 30 or 40 epochs, my 1st 20 validation accuracy is zero and loss is more ...
Satadru Hazra's user avatar
1 vote
1 answer
3k views

How to apply Layer Normalisation in LSTMCell

I want to apply Layer Normalisation to recurrent neural network while using tf.compat.v1.nn.rnn_cell.LSTMCell. There is a LayerNormalization class but how should I apply this in LSTMCell. I am using ...
Manish Kumar Garg's user avatar
1 vote
1 answer
314 views

simple LSTM implementation in tensorflow: Consider casting elements to a supported type error

I'm trying to implement a simple LSTM cell on Tensorflow to compare its performance with another one I implemented previously. x = tf.placeholder(tf.float32,[BATCH_SIZE,SEQ_LENGTH,FEATURE_SIZE]) y = ...
RADJA's user avatar
  • 11
1 vote
1 answer
190 views

Keras ValueError: Dimensions must be equal LSTM

I'm creating a Bidirectional LSTM but I faced following error ValueError: Dimensions must be equal, but are 5 and 250 for '{{node Equal}} = Equal[T=DT_INT64, incompatible_shape_error=true](ArgMax, ...
mj lajy's user avatar
  • 21
1 vote
0 answers
429 views

Error while replicating Keras-LSTM example for SHAP-based interpretability

I am trying to replicate Keras-LSTM DeepExplainer example. I am getting the following error when trying to compute the shap values: This warning: keras is no longer supported, please use tf.keras ...
Isee's user avatar
  • 11
1 vote
0 answers
60 views

Tensorflow: Shapes (None, 1) and (None, 1, 10) are incompatible

I'm building an RNN and am having trouble passing in the data. The csv file I'm pulling data from has a sentence column, and a label column that's filled with a binary classification value (1 or 0). ...
AKang123.'s user avatar
  • 425
1 vote
1 answer
187 views

ValueError when loading a text classification model in Tensorflow

I am getting an error when I try to load the model with tf.keras.models.load_model() and I am getting the following error ValueError: The mask that was passed in was tf.RaggedTensor(values=Tensor(&...
Electric Dragon's user avatar
1 vote
0 answers
436 views

Dimensional error in the non-linguistic dataset as input to LSTM based Encoder-decoder model using attention

I'm trying to implement attention -LSTM based encoder decoder model for multi-class classification. The dataset is non-linguistic in nature. Characteristics of my dataset: x_train.shape = (930,5) ...
Sukhmani Kaur Thethi's user avatar
1 vote
1 answer
608 views

Can I split my long sequences into 3 smaller ones and use a stateful LSTM for 3 samples?

I am doing a time-series sequence classification problem. I have 80 time-series all length 1002. Each seq corresponds to 1 of 4 categories (copper, cadmium, lead, mercury). I want to use Keras LSTMs ...
codeananda's user avatar
  • 1,087
1 vote
0 answers
167 views

Output layer of LSTM (many to many)

I want to use LSTM to predict Y (size = [batch_size, time_length=1, feature_dim=3]) from X (size = [batch_size, time_length=42, feature_dim=12]). The problem is using data (12 features) during past 42 ...
Xu Shan's user avatar
  • 197
1 vote
0 answers
393 views

Tensorflow custom loss function - can't get samples of y_pred and y_true in loss function

I'm running an LSTM network that works fine (TF 2.0). My problem starts when trying to modify the loss function. I planed to adjust some data manipulation over 'y_true' and 'y_pred' but since TF force ...
Ran Kremer's user avatar
1 vote
0 answers
401 views

Custom training loops for LSTMs (Tensorflow 2)

I am currently implementing the neural image captioning model shown here: https://www.tensorflow.org/tutorials/text/image_captioning The training loop passes a batch of sentences word by word into ...
CS1999's user avatar
  • 23
1 vote
0 answers
266 views

How can I create keras functional api of multiple inputs and outputs?

The network consist of encoder, lstm and decoder. The encoder take an input image sequence (TimeDistribution) and extract 2 outputs with different shape. one use for lstm and pass it to decoder and ...
Alpha9's user avatar
  • 121
1 vote
2 answers
849 views

Tensorflow 2 custom LSTM Cell initial states

I try to implement a custom LSTM cell. Firstly, I try to reproduce the original LSTM cell before I put customization. However, I run into a problem that the initial state is a single tensor instead of ...
lzj994's user avatar
  • 11
0 votes
1 answer
1k views

How to combine independent CNN and LSTM networks

I'm currently working with timeseries forecasts using tensorflow and keras. I built an CNN which performs quite good and a basic LSTM with shows also quite good results. Now I was thinking to combine ...
Max2603's user avatar
  • 413
0 votes
1 answer
954 views

Cannot have names for input and output in keras model.fit

In short: Why does this line work - model.fit(x_train, y_train, epochs=30, batch_size=40, verbose=2) And this line doesn't model.fit({"word_input": x_train, "main_output": y_train}...
odbhut.shei.chhele's user avatar
0 votes
1 answer
103 views

How to add mask for padded sentences in LSTM layer in a binary classification problem?

I am trying to design a LSTM-CNN model using glove embeddings and some dialogue act information as text features, I have used padding at two levels: within a sentence to make all sentences of equal ...
Aizayousaf's user avatar
0 votes
1 answer
236 views

next character prediction with GRU gives different results each time

I am trying to predicts a evolution of sentiments in a dialouge. To that end, I have used BERT to get the sentiments. Then for each call, I have encoded sentiments as P for Positive, E for Negative ...
Reza Afra's user avatar
  • 185
0 votes
1 answer
770 views

Multiclass classification LSTM keras

I'm stuck in writing keras code for multiclass classification problem. I will expose my problem. I have a dataset in a single csv file which has rows in the following form 1.45 -10.09 1.02 1 ...
Matteo Sirizzotti's user avatar
0 votes
1 answer
525 views

Keras continuous training with DB

I am new to Keras and still looking for ways for continuous training the model. Since my dataset is very large to store in memory, I am supposed to store in a DB (NoSql DB- MongoDb or HBase) and train ...
Débora's user avatar
  • 5,856
0 votes
1 answer
221 views

How to understand and debug the error inside keras.model.fit?

I am trying to implement a keras LSTM. I am getting an error inside keras.model.fit. I am not understanding what this error means. My code is given below - print(x_train.shape) print(y_train.shape) ...
odbhut.shei.chhele's user avatar
0 votes
0 answers
33 views

Is it possible to assign to a tf.SymbolicTensor during graph execution?

I have a tf.function I'm trying to execute as the training step to a keras.layers.LSTM. During the execution of this function, I happen to need to assign an intermediate value (computed within the tf....
Sukrit's user avatar
  • 1
0 votes
0 answers
21 views

Error with CNN-LSTM on Keras: ValueError: Input 0 of layer sequential is incompatible with the layer: expected ndim=4, found ndim=3

I was trying to create a CNN-LSTM model and I received an error message: ` ValueError: Input 0 of layer sequential is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: (...
junhua's user avatar
  • 1
0 votes
0 answers
48 views

Tensorflow/Keras LSTM RNN model for consumption forecast not learning/underfitting

Hi everyone I need help! I have build a LSTM RNN model with Tensorflow and Keras to predict the electricity consumption of a building. I have half hourly data since august 2021 (just above 4 million ...
ben's user avatar
  • 1
0 votes
0 answers
13 views

RNN where features are sequences with different lengths

I have a sequential RNN using Keras. Some of my features are sequences with different lengths (eg time series where data is collected daily or monthly) and some other features are scalars. Would this ...
as76's user avatar
  • 71
0 votes
0 answers
38 views

'TfidfVectorizer' object has no attribute 'vocabulary_'

print(tfidf.vocabulary_) saya memiliki code berikut yang salah import numpy as np import pandas as pd import tensorflow as tf import string from sklearn.model_selection import train_test_split from ...
reza elfariadi's user avatar
0 votes
0 answers
30 views

Create a custom LSTM Layer which feedbacks output as input in next time step

I proceeded with idea of using raw_rnn function for writing a custom LSTM Layer, such that output of previous time step is passed as input of next time step. I find it difficult to extend the model ...
Senume's user avatar
  • 1
0 votes
0 answers
107 views

Error while importing tensorflow: No module named tensorflow.tsl

I've working on RNN_LSTM and the codes were working well just a month ago, but now gives errors, I tried to fix but no result.... Found out the error is on TensorFlow I installed successfully but can'...
Sana Isam's user avatar
0 votes
1 answer
99 views

Tensorflow ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray)

I am trying to train an LSTM model using sequences of numbers for a binary classification task. I don't want to pad the sequences and for this reason I set batch_size = 1. My data looks like this ...
Paschalis's user avatar
  • 181
0 votes
0 answers
68 views

how to make a stacked keras LSTM

My Tensorflow non-stacked LSTM model code works well for this: # reshape input to be [samples, time steps, features] trainX = np.reshape(trainX, (trainX.shape[0], 1, trainX.shape[1])) testX = np....
bbartling's user avatar
  • 3,360
0 votes
0 answers
27 views

How to train a LSTM with a sequence of numbers with different lenghts?

I am trying to train a LSTM with a dataset in which both the input and the output are a sequence of numbers of different lenght. Each number in the input represents a timestep. Example of input and ...
Esteban's user avatar
0 votes
0 answers
95 views

How can I get non-negative outputs in time series forecasting using LSTM

I am doing a prediction for time series data using lstm keras. The train does not contain any negative numbers. The issue is, when the predicting test data, the outputted prediction sometimes is ...
Leila Mirzaei's user avatar
0 votes
1 answer
137 views

LSTM training difficulties

I wanted to train LSTM model for tabular time series data. My data shape is ((7342689, 50, 5), (7342689,)) I was having a hard time to handle the training loss. Initially I tried with default ...
ForestGump's user avatar