-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with using masking in Embedding Layer for POS Tagging Model #20754
Comments
Hi @N0-Regrets - Thanks for reporting the issue.I have reproduce the code with dummy X_train,Y_train, embedding matrix,vocablen and taglen data. Attached gist for your reference with dummy data and your model is working fine. |
@mehtamansi29 , Please change the dataset size to other than (32,10) for eg say (50,10) and see. The behavior can be replicable. @N0-Regrets , Could you please change the |
@N0-Regrets , Also you can alternatively enable eager execution(If performance is not an issue for you) by adding |
@Surya2k1, @mehtamansi29, Thank you very much for your help. I really appreciate the time and effort . I also wanted to mention that the same problem occurs when using a masking layer after the embedding layer even if the model = keras.Sequential([
keras.Input(shape = (200,)),
keras.layers.Embedding(weights = [embedding_matrix], input_dim = vocab_len,
output_dim = 50, mask_zero = False),
keras.layers.Masking(mask_value = 0),
keras.layers.Bidirectional(keras.layers.LSTM(units = 100, return_sequences = True )),
keras.layers.Bidirectional(keras.layers.LSTM(units = 100, return_sequences = True)),
keras.layers.TimeDistributed(keras.layers.Dense(units = tags_len, activation = "softmax") )
])
model.summary() I thought it might be helpful to bring it to your attention in case it needs addressing as well. Thanks again, and keep up the good work !!! 😊 |
Hi @N0-Regrets - Here if use masking layer after the embedding layer will give
As mentioned previous comment while compile the model use Attached gist for the for the reference. |
Hello, I am training a Part-of-Speech (POS) tagging model . My model includes an Embedding layer with
mask_zero = True
parameter to handle padding tokens. However, when I attempt to train the model, I encounter an error, but when I don't use masking the code works fine. I don't really know what am I doing wrong.
Thanks in advance ❤️
Below is my model architecture and code:
Below is the full error message:
The text was updated successfully, but these errors were encountered: