tensorflow: Bert Preprocess Model not working on windows 10

I have the same issue described here error-with-using-bert-model-from-tensorflow

I get this exception when i try to use the bert preprocessor on windows 10

Trying to access resource using the wrong type. Expected class tensorflow::lookup::LookupInterface got class tensorflow::lookup::LookupInterface

Stack trace

File "C:\work\vpython\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1100, in fit
    tmp_logs = self.train_function(iterator)
  File "C:\work\vpython\lib\site-packages\tensorflow\python\eager\def_function.py", line 828, in __call__
    result = self._call(*args, **kwds)
  File "C:\work\vpython\lib\site-packages\tensorflow\python\eager\def_function.py", line 888, in _call
    return self._stateless_fn(*args, **kwds)
  File "C:\work\vpython\lib\site-packages\tensorflow\python\eager\function.py", line 2942, in __call__
    return graph_function._call_flat(
  File "C:\work\vpython\lib\site-packages\tensorflow\python\eager\function.py", line 1918, in _call_flat
    return self._build_call_outputs(self._inference_function.call(
  File "C:\work\vpython\lib\site-packages\tensorflow\python\eager\function.py", line 555, in call
    outputs = execute.execute(
  File "C:\work\vpython\lib\site-packages\tensorflow\python\eager\execute.py", line 59, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError:  Trying to access resource using the wrong type. Expected class tensorflow::lookup::LookupInterface got class tensorflow::lookup::LookupInterface
	 [[{{node prediction/keras_layer_1/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall/bert_tokenizer/StatefulPartitionedCall/WordpieceTokenizeWithOffsets/WordpieceTokenizeWithOffsets/WordpieceTokenizeWithOffsets}}]] [Op:__inference_train_function_52076]
Function call stack:
train_function

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 23 (5 by maintainers)

Most upvoted comments

Are you satisfied with the resolution of your issue? Yes No

@Saduf2019 Windows 10: Version 20H2 19042.685 Python version: 3.8.5 tf version: 2.4.0

Steps to reproduce this bug: Following this exactly: https://www.tensorflow.org/tutorials/text/classify_text_with_bert until

text_test = ['this is such an amazing movie!'] text_preprocessed = bert_preprocess_model(text_test)

And I’ll get exact the same error mentioned above

Closing as stale. Please reopen if you’d like to work on this further.

@jvishnuvardhan I ran the code on tf 2.4 and nightly please fidn the gist here

I also have this issue.

Windows 10: Version: 10.0.18363 Python version: 3.8.5 tf version: 2.4.0

It runs fine in the Colab notebook: https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/text/classify_text_with_bert.ipynb but not in my local jupyter notebook