You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running the following line of code: response, inputs, masked_text = bert_predictor.predict(texts)
the following error comes up for the shape of the tensor. I have followed the jupyter notebook as is.
(tf version: 1.15.2)
/tensorflow-1.15.2/python3.6/tensorflow_core/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1208 arg_name, arg,
1209 self._func_graph.inputs[i].shape,
-> 1210 arg.shape))
1211 elif (self._signature is not None and
1212 isinstance(self._signature[i], tensor_spec.TensorSpec)):
ValueError: The argument 'mlm_positions' (value Tensor("Const_20:0", shape=(0,), dtype=int64)) is not compatible with the shape this function was traced with. Expected shape (?, 45), but got shape (0,).
If you called get_concrete_function, you may need to pass a tf.TensorSpec(..., shape=...) with a less specific shape, having None on axes which can vary.`
The text was updated successfully, but these errors were encountered:
The code is only compatible with tf2, could you try re-running with tensorflow >= 2.0? You may need to run "!pip install tensorflow" in the colab notebook. Then to confirm your version "print(tf.__version__)".
While running the following line of code:
response, inputs, masked_text = bert_predictor.predict(texts)
the following error comes up for the shape of the tensor. I have followed the jupyter notebook as is.
(tf version: 1.15.2)
----------------------Error--------------------------
`ValueError Traceback (most recent call last)
in ()
----> 1 response, inputs, masked_text = bert_predictor.predict(texts)
2 train_inputs = response['cls_token']
3 train_labels = tf.convert_to_tensor(classes)
3 frames
in predict(self, texts, mlm_ids, context_tokens)
140 input_mask=tf.convert_to_tensor(inputs['input_mask'], dtype=tf.int64),
141 input_ids=tf.convert_to_tensor(inputs['input_ids'], dtype=tf.int64),
--> 142 mlm_positions=tf.convert_to_tensor(inputs['mlm_ids'], dtype=tf.int64),
143 )
144
/tensorflow-1.15.2/python3.6/tensorflow_core/python/eager/function.py in call(self, *args, **kwargs)
1079 TypeError: For invalid positional/keyword argument combinations.
1080 """
-> 1081 return self._call_impl(args, kwargs)
1082
1083 def _call_impl(self, args, kwargs, cancellation_manager=None):
/tensorflow-1.15.2/python3.6/tensorflow_core/python/eager/function.py in _call_impl(self, args, kwargs, cancellation_manager)
1119 raise TypeError("Keyword arguments {} unknown. Expected {}.".format(
1120 list(kwargs.keys()), list(self._arg_keywords)))
-> 1121 return self._call_flat(args, self.captured_inputs, cancellation_manager)
1122
1123 def _filtered_call(self, args, kwargs):
/tensorflow-1.15.2/python3.6/tensorflow_core/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1208 arg_name, arg,
1209 self._func_graph.inputs[i].shape,
-> 1210 arg.shape))
1211 elif (self._signature is not None and
1212 isinstance(self._signature[i], tensor_spec.TensorSpec)):
ValueError: The argument 'mlm_positions' (value Tensor("Const_20:0", shape=(0,), dtype=int64)) is not compatible with the shape this function was traced with. Expected shape (?, 45), but got shape (0,).
If you called get_concrete_function, you may need to pass a tf.TensorSpec(..., shape=...) with a less specific shape, having None on axes which can vary.`
The text was updated successfully, but these errors were encountered: