Replicating tensorflow bert model in R

Viewed 40

I am just replicating this code based on Basic Text Classification. Until the below line, it seems alright. However, the following line:

vectorize_layer %>% adapt(train_text)

throws me an error as below. Any idea, how should I approach it in order to solve it ? My tensorflow version is TensorFlow v2.8.2, is it the main issue for this error ?

I assume that the train_text should not be like that as well, should it ?

> train_text
<MapDataset element_spec=TensorSpec(shape=(None,), dtype=tf.string, name=None)>

The thrown error:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
RuntimeError: in user code:

File "C:\ANACON~2\envs\R-TENS~1\lib\site-packages\keras\engine\base_preprocessing_layer.py", line 118, in adapt_step *
self.update_state(data)
File "C:\ANACON~2\envs\R-TENS~1\lib\site-packages\keras\layers\preprocessing\text_vectorization.py", line 431, in update_state **
self._lookup_layer.update_state(self._preprocess(data))
File "C:\ANACON~2\envs\R-TENS~1\lib\site-packages\keras\layers\preprocessing\text_vectorization.py", line 512, in _preprocess
inputs = self._standardize(inputs)
File "C:\Users\xxxxx\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\call.py", line 21, in python_function
raise RuntimeError(res[kErrorKey])

RuntimeError: Evaluation error: attempt to apply non-function.
0 Answers
Related