Skip to content
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

Keras dimension incompatibility when trying to create BigPhoney instance #4

Open
jsrozner opened this issue Jun 30, 2020 · 1 comment

Comments

@jsrozner
Copy link

from big_phoney import BigPhoney
p = BigPhoney()

2020-06-29 17:22:37.950128: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-06-29 17:22:37.965589: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fa9bae19a30 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-29 17:22:37.965621: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/big_phoney.py", line 15, in init
self.pred_model = PredictionModel()
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 16, in init
self.training_model, self.encoder, self.decoder = self._build_model()
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 75, in _build_model
context = get_context(encoder_outputs, h)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 38, in get_context
context = attn_dot([attention_weights, encoder_outputs])
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 897, in call
self._maybe_build(inputs)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2416, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/utils/tf_utils.py", line 316, in wrapper
output_shape = fn(instance, input_shape)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/layers/merge.py", line 677, in build
'Chosen axes: %s, %s' % (axes[0], axes[1]))
ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1

Any ideas? Tensorflow is version 2.2 and keras is up to date

@meooow25
Copy link

meooow25 commented Oct 1, 2020

It works if you change this line

char_inputs = Input(shape=(None,))

to

char_inputs = Input(shape=(MAX_CHAR_SEQ_LEN,))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants