Closed addy1997 closed 3 years ago
@addy1997 I ran the code shared and face a different error, please find the gist here.
@Saduf2019 Here's my colab link
for uploading files
essay.csv file link - https://github.com/addy1997/Task9-personality-prediction/blob/main/essays.csv link to imdb-train-val-testN.pickle file - https://github.com/addy1997/Task9-personality-prediction/blob/main/imdb-train-val-testN.pickle
@addy1997 I ran the code but face a truncating error, please find the gist here.
@Saduf2019 were you able to get rid of the error?
I am able to replicate the issue reported on 2.x, please find the gist here for nightly, and tf 2.4
I am able to replicate the issue reported on 2.x, please find the gist here.
That's great. Now, what do you suggest about the issue? What is to be done to solve it? @tensorflower-gardener can you suggest something on this?
@addy1997 Is it possible to share a simple standalone code to reproduce the issue? Thanks!
@addy1997 Is it possible to share a simple standalone code to reproduce the issue? Thanks!
Sorry, it is not possible to provide a standalone code without loading files as I am performing text classification which requires the ".pickle" file to be loaded.
This is low priority for us right now, but please consider contributing a fix!
This is low priority for us right now, but please consider contributing a fix!
This is a new issue and really important part of my project. At least, can you give me some hint about how to tackle this @mattdangerw ? I have asked it on stackoverflow but they told me to raise an issue on github.
Hi sorry for the quick reply above, was typing fast in our triage meeting.
Dug a little deeper. This looks like a duplicate of #33755
I would suggest the workaround here, can you see if this works for you?
We have also bumped up the priority for the #33755.
Thanks for bringing this up!
Hi sorry for the quick reply above, was typing fast in our triage meeting.
Dug a little deeper. This looks like a duplicate of #33755
I would suggest the workaround here, can you see if this works for you?
We have also bumped up the priority for the #33755.
Thanks for bringing this up!
@mattdangerw the workaround you suggested isn't working for my code. Here's the colab
With the workaround, you should be removing any use of embeddings_constraint
completely. You may need to switch to a functional model.
This is broken with #33755:
X = np.random.randint(100, size=(32, 10))
Y = np.ones((32, 1))
model = tf.keras.Sequential()
model.add(tf.keras.layers.Embedding(100, 8, input_length=10, embeddings_constraint=tf.keras.constraints.UnitNorm(axis=1)))
model.add(tf.keras.layers.Dense(1))
model.compile('rmsprop', 'mse')
model.fit(X, Y)
This should work:
X = np.random.randint(100, size=(32, 10))
Y = np.ones((32, 1))
input = tf.keras.Input(shape=(10,))
output = tf.keras.layers.Embedding(100, 8, input_length=10)(input)
output = tf.keras.constraints.UnitNorm(axis=1)(output)
output = tf.keras.layers.Dense(1)(output)
model = tf.keras.Model(input, output)
model.compile('rmsprop', 'mse')
model.fit(X, Y)
For updates on the main bug, follow #33755. This bug can be closed as a duplicate.
@mattdangerw thanks a lot. I removed the embedding constraint and trained my model. It worked perfectly. colab.
Though the model overfits (validation acc.- 53% and accuracy= 0.9987%), I will try to optimize it. Thanks to @jvishnuvardhan and @Saduf2019 for their guidance. This bug was really important.
I am trying to train my model using Keras and TensorFlow 2.x, while using the model.fit() method I ran into this error
Error
System information
Code is given below. Link to the colab for full code.
The line that throws the error
Tweaks I tried
Please can anyone suggest a solution? Thanks