LuzProject / luz

Build system targeting Apple Darwin-based operating systems.
70 stars 3 forks source link

Issue with lux::fit - Unclear Error Message #8

Open trevb11 opened 9 months ago

trevb11 commented 9 months ago

I am fitting an auto encoder but the lug::fit method is not working, and returns an unclear error message. Adding PYTORCH_ENABLE_MPS_FALLBACK=1 to the R Environment did not work

train_dl <- torch::dataloader( zip_train, batch_size = 10, shuffle = TRUE)

my_optimizer <- function(parameters){ torch::optim_adadelta(parameters, lr=1) }

after.setup <-luz::setup( autoencoder, loss = torch::nnf_mse_loss, optimizer = my_optimizer)

fit auto encoder

fitted <- luz::fit(after.setup, train_dl, epochs=100)

Error Message:

Epoch 1/100 Error in (function (x) : object 'delf' not found In addition: Warning message: Some torch operators might not yet be implemented for the MPS device. A temporary fix is to set the PYTORCH_ENABLE_MPS_FALLBACK=1 to use the CPU as a fall back for those operators: ℹ Add PYTORCH_ENABLE_MPS_FALLBACK=1 to your .Renviron file, for example use usethis::edit_r_environ(). ✖ Using Sys.setenv() doesn't work because the env var must be set before R starts.