tests/testthat/notrun/test_6_finetune.R

library(testthat)
library(tibble)
library(text)
library(stringi)

context("Testing tasks")


test_that("Task Fine-tuning tests", {
  skip_on_cran()

# It is removed for now since it does not complete in Windows without error
#
#  #help("textFineTuneTask")
#  unlink("./run_reg", recursive = TRUE)
#  test <- text::textFineTuneTask(Language_based_assessment_data_8[,c("satisfactiontexts",
#                                                             "hilstotal")],
#                         model_name_or_path = "distilbert-base-uncased",
#                         is_regression = TRUE,
#                         output_dir = "./run_reg")
#
#  # This is because some systems show this as:test <- "\033[0;32mCompleted\033[0m"
#  test <- tolower(test)
#  test1 <- stringi::stri_extract_all_fixed(test, "completed")[[1]]
#  testthat::expect_equal(test1, "completed")
#
#  # Remove the folder
#  unlink("./run_reg", recursive = TRUE)
#  textModels()
#  unlink("./run_clf", recursive = TRUE)
#  text::textFineTuneTask(Language_based_assessment_data_8[,c("satisfactiontexts",
#                                                             "gender")],
#                         model_name_or_path = "distilbert-base-uncased",
#                         is_regression = FALSE,
#                         output_dir = "./run_clf",
#                         label_names = c("male", "female"))
#
#  # remove the folder
#  unlink("./run_clf", recursive = TRUE)

})

Try the text package in your browser

Any scripts or data that you put into this service are public.

text documentation built on Aug. 9, 2023, 5:08 p.m.