Skip to content

Replicating tensorflow bert model in R #544

@ozturkib

Description

@ozturkib

Stackoverflow question is here.
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 ? It is not! Because I have also recreate new environment with v2.9.1, nothing is changed.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions