From f830bc9764db90386302b4df0b19948474904427 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Thu, 20 Jul 2023 19:37:19 +0200 Subject: [PATCH] fix: bug in cache folder --- R/TaskClassif_tiny_imagenet.R | 4 ++-- tests/testthat/test_TaskClassif_tiny_imagenet.R | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/TaskClassif_tiny_imagenet.R b/R/TaskClassif_tiny_imagenet.R index 57dcfdba..fbd27f9e 100644 --- a/R/TaskClassif_tiny_imagenet.R +++ b/R/TaskClassif_tiny_imagenet.R @@ -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) diff --git a/tests/testthat/test_TaskClassif_tiny_imagenet.R b/tests/testthat/test_TaskClassif_tiny_imagenet.R index 148059a6..5ad5e609 100644 --- a/tests/testthat/test_TaskClassif_tiny_imagenet.R +++ b/tests/testthat/test_TaskClassif_tiny_imagenet.R @@ -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)