Skip to content

Commit

Permalink
Magick to base loader (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
cxzhang4 authored Nov 8, 2024
1 parent 0edcf48 commit bd80db5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Suggests:
igraph,
jsonlite,
knitr,
magick,
mlr3tuning (>= 1.0.0),
progress,
rmarkdown,
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerTorchImage.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LearnerTorchImage = R6Class("LearnerTorchImage",
#' @description
#' Creates a new instance of this [R6][R6::R6Class] class.
initialize = function(id, task_type, param_set = ps(), label, optimizer = NULL, loss = NULL,
callbacks = list(), packages = c("torchvision", "magick"), man, properties = NULL,
callbacks = list(), packages = "torchvision", man, properties = NULL,
predict_types = NULL) {
properties = properties %??% switch(task_type,
regr = c(),
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ dataset_image = dataset("image_dataset",
self$uris = uris
},
.getitem = function(x) {
list(x = torchvision::transform_to_tensor(magick::image_read(self$uris[x])))
list(x = torchvision::transform_to_tensor(torchvision::base_loader(self$uris[x])))
},
.length = function() {
length(self$uris)
Expand Down
6 changes: 3 additions & 3 deletions man/mlr_learners.torchvision.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/mlr_learners_torch_image.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/mlr_pipeops_nn_adaptive_avg_pool1d.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/testthat/test_LearnerTorchVision.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test_that("LearnerTorchVision basic checks", {
vgg13$id = "a"
expect_false(alexnet$phash == vgg13$phash)
expect_true("torchvision" %in% alexnet$packages)
expect_true("magick" %in% alexnet$packages)

alexnet = lrn("classif.alexnet", optimizer = "sgd", loss = "cross_entropy",
callbacks = t_clbk("checkpoint"), epochs = 0, batch_size = 1
Expand Down

0 comments on commit bd80db5

Please sign in to comment.