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

Replicating tensorflow bert model in R #544

Open
ozturkib opened this issue Sep 5, 2022 · 1 comment
Open

Replicating tensorflow bert model in R #544

ozturkib opened this issue Sep 5, 2022 · 1 comment

Comments

@ozturkib
Copy link

ozturkib commented Sep 5, 2022

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.
@t-kalinowski
Copy link
Member

Hi, I just re-rendered the qmd on my local machine and it rendered without issue.

Perhaps this is a windows or conda specific issue? Can you please try under WSL and see if it works there?

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