Comments (9)
Instead of input length:10 I used input_shape=(10,) to reproduce the same effect. It worked for me. But when u read the documentation u won't find anything like input_shape you would only find input_length.
from tensorflow.
Ok I tried converting the input_length to input_shape of(10,) formulating what it was trying to say in the documentation. (On searching I found this). But shouldn't that be updated in documentation as well?
from tensorflow.
ValueError: Unrecognized keyword arguments passed to Embedding: {'input_length': 10}
how to solve this error
from tensorflow.
Hi @theraghavjuneja ,
Sorry for the delay, I tried to run your code on Colab using TF v2.16.1, nightly and faced the same issue. Please find the gist here for reference.
Thank you!
from tensorflow.
Hi @theraghavjuneja ,
The error occurs because the Embedding layer in TensorFlow 2.x does not have an input_length argument. This argument was removed in version 2.0.0 of TensorFlow.
To fix this error, you need to remove the input_length argument from the Embedding layer. The input_length argument is used to specify the maximum length of the input sequences. However, in TensorFlow 2.x, the Embedding layer automatically infers the input length from the input data. Please find the gist here for reference.
from tensorflow.
Instead of input length:10 I used input_shape=(10,) to reproduce the same effect. It worked for me. But when u read the documentation u won't find anything like input_shape you would only find input_length.
I created an LSTM-based sequential model for text generation. I updated my keras to 3.1.1 and had the same issue. Using input_shape=(25,)
worked for my model. Thanks.
from tensorflow.
Hi @TomBerton : I am hitting this same issue with TF==2.16 version for my CNN Word2Vector Embeddings
Define the CNN model
model = Sequential()
model.add(Embedding(vocab_size, 100, weights=[embedding_matrix],input_length=max_length, trainable=False))
model.add(Conv1D(128, 5, activation='relu'))
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 %
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep Tensroflow
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 %
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep Tensorflow
]% (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % ]
zsh: command not found: ]
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep tensorflow
tensorflow 2.16.1
tensorflow-datasets 4.9.4
tensorflow-estimator 2.12.0
tensorflow-io-gcs-filesystem 0.36.0
tensorflow-metadata 1.14.0
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 %
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep keras
keras 3.1.1
tf_keras 2.16.0
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 %
from tensorflow.
Hi @TomBerton : I am hitting this same issue with TF==2.16 version for my CNN Word2Vector Embeddings
Define the CNN model
model = Sequential() model.add(Embedding(vocab_size, 100, weights=[embedding_matrix],input_length=max_length, trainable=False)) model.add(Conv1D(128, 5, activation='relu'))
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep Tensroflow (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep Tensorflow ]% (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % ] zsh: command not found: ] (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep tensorflow tensorflow 2.16.1 tensorflow-datasets 4.9.4 tensorflow-estimator 2.12.0 tensorflow-io-gcs-filesystem 0.36.0 tensorflow-metadata 1.14.0 (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % pip list | grep keras keras 3.1.1 tf_keras 2.16.0 (DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 %
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 % python CNN_WordVec.py
Traceback (most recent call last):
File "/Users/akram_personal/AKRAM_CODE_FOLDER/DS_EXERCISES/DS_2024/CNN_WordVec.py", line 114, in
model.add(Embedding(vocab_size, 100, weights=[embedding_matrix], trainable=False))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/DS/lib/python3.11/site-packages/keras/src/layers/core/embedding.py", line 81, in init
super().init(**kwargs)
File "/opt/anaconda3/envs/DS/lib/python3.11/site-packages/keras/src/layers/layer.py", line 264, in init
raise ValueError(
ValueError: Unrecognized keyword arguments passed to Embedding: {'weights': [array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]])]}
(DS) akram_personal@AKRAMs-MacBook-Pro DS_2024 %
from tensorflow.
Are you satisfied with the resolution of your issue?
Yes
No
from tensorflow.
Related Issues (20)
- TensorFlow lite Whisper model get worse inference result. HOT 1
- Not getting the same result when using .tflite in C and Python.
- Math problem HOT 1
- Cannot import tflite_support.task when tensorflow is installed HOT 2
- Incapable of loading a tf v1 model
- Action of the matrix exponential on vectors HOT 2
- Fetch HOT 1
- XNNPACK delegate doesn't support to broadcast last dimension for Prelu operator HOT 1
- Failing Tensorflow unit tests for BF16 hardware
- Interpreter in Swift fails with `EXC_BAD_ACCESS` at `Interpreter.copy(data, toInputAt: 0)` and `Interpreter.input(at: 0)` in some circumstances HOT 1
- Could not find any nvml.h during building from source in docker HOT 1
- Configurable attribute "deps" in @XNNPACK//:prod_microkernels doesn't match this configuration
- benchmark_model no longer cross-compiles for Android from macOS HOT 1
- Inference time using Interpreter API on Android inconsistent and 10–50 times slower than same tflite model on iOS HOT 9
- Basic regression: Predict fuel efficiency Probelm HOT 3
- [
- [Question] Is it possibile to use `jit_compile=True` (XLA) when input is a string? HOT 4
- Homepage sections displaying incorrectly on TensorFlow website HOT 3
- Wrong quantized_dimension (axis) when "per-channel" quantization
- tf.function deadlock with multiple multiprocess/threading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow.