tests/testthat/test-encoding.R

test_that("Encoding", {
  expect_snapshot_error(encoding$new(1))
})

test_that("can get attributes from encoding", {
  
  tok <- tokenizer$from_file(test_path("assets/tokenizer.json"))
  encoding <- tok$encode("Hello world")
  
  expect_equal(encoding$ids, c(15496, 995))
  expect_equal(encoding$attention_mask, c(1,1))
})

Try the tok package in your browser

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

tok documentation built on Sept. 11, 2024, 5:21 p.m.