OscarKjell / text

Using Transformers from HuggingFace in R

Home Page:https://r-text.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in dir.exists(x) : file name conversion problem -- name too long?

SamuFP opened this issue · comments

Hello,

I found your package very interesting and I tried to use it a bit following the instructions on the website, but after the following command:

library(text) wordembeddings <- textEmbed(Language_based_assessment_data_8, model = 'bert-base-uncased')

I keep getting this message:

Error in dir.exists(x) : file name conversion problem -- name too long?

I'm pretty new at working with R so it may be a problem of mine, but I'm just copying the code directly from the website so I don´t know.

Thank you in advance.

Hi,
Perhaps try having library(text on its own row.
Also please find more information in our preprint: https://psyarxiv.com/293kt
You may also find the extended installation guidelines useful: http://r-text.org/articles/Extended_Installation_Guide.html

Please let me know if this doesn't help.
Kind Regards,

Thanks for answering so quickly!

I´ll read the installation guidelines first and if I keep getting this error, I´ll let you know.

Thanks again :)

Hello again,

I was able to solve the problem. It turns out that my Windows user had an 'ó' and therefore I had problems with the file path. I was able to fix that part a couple of days ago.

On the other hand, I have some problems with the 'wordebedding' function. I have followed all the steps in the extended installation guide, like installing 'miniconda' and the 'reticulate' package. However, when I run the function I get this error:

> wordembeddings <- textEmbed(sq_data)
Error in py_run_file_impl(file, local, convert) : ModuleNotFoundError: No module named 'torch'

Next, when I try to install the 'torch' module with the advanced installation guide command I get this error:

> conda_install(envname = 'r-reticulate', c('torch==0.4.1', 'transformers==3.3.1', 'numpy', 'nltk'), pip = TRUE)
ERROR: Could not find a version that satisfies the requirement torch==0.4.1 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 1.7.0, 1.7.1, 1.8.0, 1.8.1)
ERROR: No matching distribution found for torch==0.4.1
Error: Error installing package(s): "torch==0.4.1", "transformers==3.3.1", "numpy", "nltk"

I have tried several things: using normal RStudio, using it through Anaconda to search for the packages and install them from there, but nothing works for me.

It's a pity because me and my team are very interested in this package and all the possibilities it offers, but as I told you, I'm relatively new to R and my Python knowledge is not very advanced either.

In case you can't help me, I will keep a close eye on how the package progresses as we believe it has a lot of possibilities in the field of social sciences. Finally, I don't know to what extent it is possible, but I was wondering if in the future you could include all the packages and modules that need to be downloaded separately inside the 'text' package itself, to make it a little more accessible for amateur users such as me.

Again, thank you very much.

Sorry to hear about this problem; thanks for informing me.
It's difficult when I cant replicate the problem. But have you tried the following:

Try without pip = TRUE in the end, like this:
conda_install(envname = 'r-reticulate', c('torch==0.4.1', 'transformers==3.3.1', 'numpy', 'nltk'))

Have you tried Reinstall reticulate and r-miniconda according to the advanced guidelines: http://r-text.org/articles/Extended_Installation_Guide.html

Finally, I made it. The solution for me was to use the command you provided, but changing 'torch==0.4.1' to 'pytorch', like this:

conda_install(envname = 'r-reticulate', c('pytorch', 'transformers==3.3.1', 'numpy', 'nltk'))

Thank you very much for your help.