mlverse / luz

Higher Level API for torch

Home Page:https://mlverse.github.io/luz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

luz_callback_model_checkpoint(save_best_only = TRUE) does not save a file

skeydan opened this issue · comments

From the unit test, but with the first call deleted:

model <- get_model()
  dl <- get_dl()

  mod <- model %>%
    setup(
      loss = torch::nn_mse_loss(),
      optimizer = torch::optim_adam,
    )

  tmp <- tempfile(fileext = "/")

  output <- mod %>%
    set_hparams(input_size = 10, output_size = 1) %>%
    fit(dl, verbose = FALSE, epochs = 10, callbacks = list(
      luz_callback_model_checkpoint(path = tmp, monitor = "train_loss",
                                    save_best_only = TRUE)
    ))

  files <- fs::dir_ls(tmp)
Error: [ENOENT] Failed to search directory '/tmp/RtmpNZqMl3/filee8e165e5548d': no such file or directory