Skip to content

Commit

Permalink
fix: bug in cache folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Jul 20, 2023
1 parent 455e69a commit f830bc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/TaskClassif_tiny_imagenet.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ NULL
# The cache_dir/datasets/tiny_imagenet folder.
constructor_tiny_imagenet = function(path) {
# path points to {cache_dir, tempfile}/data/tiny_imagenet
torchvision::tiny_imagenet_dataset(root = file.path(path, "raw"), download = TRUE)
download_folder = file.path(path, "raw", "tiny-imagenet-200")
torchvision::tiny_imagenet_dataset(root = file.path(path ), download = TRUE)
download_folder = file.path(path, "tiny-imagenet-200")

lookup = fread(sprintf("%s/words.txt", download_folder), header = FALSE)

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test_TaskClassif_tiny_imagenet.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ skip_on_cran()
test_that("tiny_imagenet task works", {
withr::local_options(mlr3torch.cache = TRUE)
task = tsk("tiny_imagenet")
expect_true("tiny-imagenet-200" %in% list.files(file.path(get_cache_dir(), "datasets", "tiny_imagenet", "raw")))
expect_true("data.rds" %in% list.files(file.path(get_cache_dir(), "datasets", "tiny_imagenet")))

dt = task$data()
expect_equal(task$backend$nrow, 120000)
Expand Down

0 comments on commit f830bc9

Please sign in to comment.