Questions tagged [bilstm]
51 questions
2
votes
1 answer
Input 0 of layer "bidirectional_2" is incompatible with the layer: expected ndim=3, found ndim=2
I am trying to classify text with bi-lstm but while I run model.predict on new dataset it is giving me this error:
Input 0 of layer "bidirectional_2" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None,…

Rubiya shoukat
- 53
- 6
2
votes
1 answer
How bert is a bidirectional?
Bert encoder takes the input and goes for the multi-head attention model. But how do they maintain sequence? Since current words don't take sequence of previous words. Besides, why is it bidirectional? Does it maintain forward and backward sequence…

kowser66
- 125
- 1
- 8
1
vote
0 answers
How to make particular recurrent connection in my Keras/tensorflow neural network model?
I have a LSTM feed-forward neural network as written below. For some reasons, I need to add a backward (recurrent) connection from layer3 to layer1 as well, which results in a loop in my model's architecture. How can I modify the below code to make…

Mohammad
- 163
- 2
- 8
1
vote
0 answers
Pre-processing audio with different durarion for BiLSTM model
due to a lack of understanding of how audio works, I have a question. What is meant in the text below? Is it required that the length of each audio is divisible by 5 without a remainder, or what?
Step 2: Transfer Spectrogram to Array: each row in…

Dan
- 11
- 2
1
vote
0 answers
Facing the issue while fitting my model (bi-lstm + crf). ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list)
I am trying to solve a problem which contains bi-LSTM and CRF, while fitting the model, i am facing this issue ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list). Below is the structure of the dataframe.
Columns…

Harshit
- 41
- 2
1
vote
0 answers
Bi directional LSTM Regularization how to increase accuracy
This is my model:
class BiLSTM(nn.Module):
def __init__(self):
super(BiLSTM, self).__init__()
self.hidden_size = 128
drp = 0.2
n_classes = len(le.classes_)
self.embedding =…

Hamza ghojaria
- 11
- 2
1
vote
0 answers
Keras LSTM, training well with return_sequences=True and not with return_sequences=False
So I have a 2D sequence that I want to use to predict another 2D sequence (map them) like:
x = [6 7; 8 9; 9 0] and y = [4 5;3 4;5 6]
I was using the sliding window approach to have 5 inputs of x to predict the single 5th value of y,
The code is as…

asmali1326
- 11
- 1
1
vote
0 answers
I use LSTM attention but model does not learn. How can I imporve model?
def __init__(self):
super().__init__()
self.lstm = nn.LSTM(input_dim,
hidden_dim,
num_layers=num_layers,
bidirectional=bidirectional,
…

Nampakka
- 11
- 1
1
vote
0 answers
How to implement Bi-Directional Conv LSTM in Pytorch
import torch
from torch import nn
def initialize_weights(self, layer):
"""Initialize a layer's weights and biases.
Args:
layer: A PyTorch Module's layer."""
if isinstance(layer, (nn.BatchNorm2d,…

Rituraj Dutta
- 55
- 5
1
vote
1 answer
Training accuracy decrease and loss increase when using pack_padded_sequence - pad_packed_sequence
I'm trying to train a bidirectional lstm with pack_padded_sequence and pad_packed_sequence, but the accuracy keeps decreasing while the loss increasing.
This is my data loader:
X1 (X[0]): tensor([[1408, 1413, 43, ..., 0, 0, 0],
…

testaja
- 43
- 4
0
votes
0 answers
realize BiLSTM in pytorch, but result is incorrect
Two nn.lstm(bidirectional=False) are used in pytorch to realize the function of a bidirectional lstm(nn.lstm(bidirectional=True)); Now the input is a stream sequence, and the result is found to be wrong. The following is my implementation and use…
0
votes
1 answer
Incorrect shapes in Tensorflow for a multiclass classification with biLSTM model
Can someone walk me through how to build a biLSTM model for multiclass classification (7 classes) using text data? the data is from a kaggle competition (https://www.kaggle.com/datasets/rmisra/news-category-dataset).
I have labelled it into 7…

Bluetail
- 1,093
- 2
- 13
- 27
0
votes
0 answers
Input size changed in after ReLU layer in tf.gradient_tape()
I am trying to loop over every layer in the network to obtain the gradient of the network.
When I loop model.layers[layernumber] in tf.gradient_tape(), ReLU layer altered the received input size from (466,36) to (466,195).
However, when I check the…

teo
- 1
0
votes
0 answers
Which model structure should be used for building a NER-like classification model on sensor data?
I am working on a seq2seq model that will work on the sensor data attached to the athlete's leg, which can mark the start and end indexes on the sensor data such as "step start" "step end" for each step taken. I'll also do same procedure for kicks…

Salihcan
- 91
- 13
0
votes
0 answers
can BiLSTM be applied to timeseries?
Consider the following BiLSTM diagram for timeseries prediction:
I believe this can easily be applied to train dataset but I do not think this is possible for the test dataset. The reverse LSTM layer learns from the future values and passes the…

learning-man
- 119
- 2
- 11