-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error on first running of transformer_scores(text = ... #21
Comments
I try on a completly new PC (win 11 Dell) with a fresh install of R and I have a differnt error in the firs run of transformer_scores(text = ... :
|
Hi, Thanks for opening the issue. The first error, looks like this issue #4. Take a look and see whether any of the solutions proposed there works for your case. The second error, looks like something else, I'll take a look at both and I'll let you know if there is a fix. |
@ibernetti63 for the first issue can you give me the output of the following code library(transforEmotion)
library(reticulate)
transforEmotion:: setup_miniconda()
use_condaenv("transforEmotion", required = TRUE)
py_run_string("import torch; print(torch.__version__)")
py_run_string("import transformers; print(transformers.__version__)") Also, did you try the example: # Load data
data(neo_ipip_extraversion)
text <- neo_ipip_extraversion$friendliness[1:5]
# Cross-Encoder DistilRoBERTa
transformer_scores(
text = text,
classes = c(
"friendly", "gregarious", "assertive",
"active", "excitement", "cheerful"
)
) I wasn't able to reproduce both issues on a fresh install (Linux), @AlexChristensen can you try on a Windows machine? |
Thank you for your quick reply. In the attached text file I have pasted the output of the commands. I used a PC with Windows 11 and R 4.4.1. Before running the commands I uninstalled miniconda to start from a clean situation. |
I run Linux on both of my computers, so I won't be able to test Windows. However, it seems like {pytorch} is acting up. You can try:
To make sure {pytorch} installs or is installed. It would be helpful to have the output of |
accidentally closed..... reopening |
C:\Users\ibern\Documents>CALL "C:\Users\ibern\AppData\Local\r-miniconda\condabin\activate.bat" "transforEmotion" C:\Users\ibern\Documents>conda.bat activate "transforEmotion"
transforEmotion (version 0.1.5) Important: If you are using RStudio, please make sure you have the latest version installed (2023.09.1-494). For bugs and errors, submit an issue to https://github.com/atomashevic/transforEmotion/issues
Installing modules for 'transforEmotion'... C:\Users\ibern\Documents>CALL "C:\Users\ibern\AppData\Local\r-miniconda\condabin\activate.bat" "transforEmotion" C:\Users\ibern\Documents>conda.bat activate "transforEmotion" |
Hi @ibernetti63, Can you test the following steps: reticulate::miniconda_uninstall()
devtools::install_github("atomashevic/transforEmotion@cpu-only-libraries", force = TRUE)
library(transforEmotion)
setup_miniconda() and then
Please paste any error or warning messages you get. Thanks for your patience with this issue. |
All modules are already installed. |
Hello, I have a similar problem. I followed the instructions to set up Python with the library(transforEmotion)
# Setup Python
setup_miniconda() The installations completed without any issues, and the following packages were installed:
I then ran the manual example from the library(transforEmotion)
data(neo_ipip_extraversion)
text <- neo_ipip_extraversion$friendliness[1:5] # positively worded items only
# Run transformer function
transformer_scores(
text = text,
classes = c(
"friendly", "gregarious", "assertive",
"active", "excitement", "cheerful"
)
) After downloading various files, the following warning appeared:
Shortly after, I received this error:
I suspect the issue may be related to CUDA. Although I haven't installed CUDA explicitly, it seems that # Check torch version
py_run_string("import torch; print(torch.__version__)")
# Output:
2.1.1+cu121
# Check transformers version
py_run_string("import transformers; print(transformers.__version__)")
# Output:
4.35.0 Questions:
Any guidance would be greatly appreciated! Update: Issue Persists with BART Model Attempted BART Model: I tried using the Facebook BART Large model for the # Facebook BART Large
transformer_scores(
text = text,
classes = c(
"friendly", "gregarious", "assertive",
"active", "excitement", "cheerful"
),
transformer = "facebook-bart"
) Process: After downloading a 1.6 GB model file, the following steps were observed:
Result:The process crashed during the "Obtaining Scores" step. No additional error messages or details were provided before the crash. Observations:
Request for Assistance:
Any advice on debugging or resolving this issue would be highly appreciated! |
Hi @snvv, Thanks for the detailed report. Regarding the first case, the error is probably related to the CUDA version of torch. We are working on this, and it is solved in the GitHub version of the package (#22), where we have CPU versions of tensorflow and torch installed by default. For the second case, the CPU version of tensorflow is running, which is OK, but since your R session is crashing, something else is the problem. How much free RAM do you have available before running this code? Which CPU do you have on your system? I will try to reproduce both errors on different machines. @ibernetti63 I haven't forgotten about your issue as well. I will investigate further and try to see if there is a fix before the release of a new version of the package. |
in the first running of transformer_scores(text = ... I recive the following error:
Requirement already satisfied: oauthlib>=3.0.0 in c:\users\ibern\appdata\local\r-miniconda\envs\transforemotion\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<1.1,>=0.5->tensorboard<2.15,>=2.14->tensorflow-intel==2.14.1->tensorflow==2.14.1) (3.2.2)
Importing transformers and torch modules...
Errore in py_module_import(module, convert = convert) :
NameError: name '_C' is not defined
Run
reticulate::py_last_error()
for details.── Python Exception Message ─────────────────────────────────────────────────
Traceback (most recent call last):
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 120, in hook
return find_and_load(name, import)
File "C:\Users\ibern\AppData\Local\R-MINI
1\envs\TRANSF1\lib\site-packages\transformers_init.py", line 26, infrom . import dependency_versions_check
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 120, in _hook
return find_and_load(name, import)
File "C:\Users\ibern\AppData\Local\R-MINI
1\envs\TRANSF1\lib\site-packages\transformers\dependency_versions_check.py", line 16, infrom .utils.versions import require_version, require_version_core
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 120, in _hook
return find_and_load(name, import)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 120, in hook
return find_and_load(name, import)
File "C:\Users\ibern\AppData\Local\R-MINI
1\envs\TRANSF1\lib\site-packages\transformers\utils_init.py", line 31, infrom .generic import (
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 120, in _hook
return find_and_load(name, import)
File "C:\Users\ibern\AppData\Local\R-MINI
1\envs\TRANSF1\lib\site-packages\transformers\utils\generic.py", line 432, inimport torch.utils._pytree as _torch_pytree
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
File "C:\Users\ibern\AppData\Local\R\win-library\4.2\reticulate\python\rpytools\loader.py", line 120, in hook
return find_and_load(name, import)
File "C:\Users\ibern\AppData\Local\R-MINI
1\envs\TRANSF1\lib\site-packages\torch_init.py", line 465, infor name in dir(_C):
NameError: name '_C' is not defined
── R Traceback ──────────────────────────────────────────────────────────────
▆
<fn>
(FALSE, 1L),<env>
)<fn>
(FALSE, 1L),<env>
)See
reticulate::py_last_error()$r_trace$full_call
for more details.The text was updated successfully, but these errors were encountered: