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 textTrainRegression

HansBaum129 opened this issue · comments

I'm running the text tutorial for the Psych Methods article. I can get the embeddings etc., but when I try the following:

model_satisfactiontext_swls <- textTrain(
x = word_embeddings$texts$satisfactiontexts, # the predictor variables (i.e., the word embeddings)
y = Language_based_assessment_data_8$swlstotal, # the criterion variable (i.e.,the rating scale score.
model_description = "author(s): Kjell, Giorgi, & Schwartz; data: N=40, population = Online, Mechanical Turk; publication: title = Example for demo; description: swls = the satisfaction with life scale")

I get the following error message:

Fold: rmse 6.051 (duration: 17.34 secs).
Fold: rmse 5.825 (duration: 32.09 secs).
Fold: rmse 6.7 (duration: 20.46 secs).
Fold: rmse 5.243 (duration: 20.81 secs).
Fold: rmse 5.193 (duration: 21.18 secs).
Fold: rmse 4.981 (duration: 21.14 secs).
Fold: rmse 7.338 (duration: 21.14 secs).
Fold: rmse 5.876 (duration: 20.33 secs).
Fold: rmse 6.994 (duration: 21.36 secs).
Fold: rmse 7.907 (duration: 21.14 secs).
Error in workflows::add_recipe():
! Can't add a trained recipe to a workflow.
Run rlang::last_trace() to see where the error occurred.
There were 21 warnings (use warnings() to see them)

rlang::last_trace()
<error/rlang_error>
Error in workflows::add_recipe():
! Can't add a trained recipe to a workflow.


Backtrace:

  1. ├─text::textTrain(...)
  2. │ └─text::textTrainRegression(...)
  3. │ └─text (local) model_save_small_size(...)
  4. │ ├─base::with(...)
  5. │ └─base::with.default(...)
  6. │ └─base::eval(substitute(expr), data, enclos = parent.frame())
  7. │ └─base::eval(substitute(expr), data, enclos = parent.frame())
  8. │ └─... %>% workflows::add_recipe(final_recipe)
  9. └─workflows::add_recipe(., final_recipe)
    Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.

I'm using 2023.12.1 Build 402 with R version 4.3.3 (2024-02-29 ucrt).

Thanks.

hi, thank you for the feedback. Can you please try using the latest version of text from Git Hub?

# install.packages("devtools")
devtools::install_github("oscarkjell/text")

(you might have to restart R to get the new changes to work).

please let me know if this works.

thanks for the feedback.
(I will update these for the tutorial)