Reputation: 568
Trying to run the temperature forecasting problem from Deep Learning in R. When I get to the section "A basic machine learning approach," running the fit_generator function below causes R to hang indefinitely.
history <- model %>% fit_generator(
train_gen,
steps_per_epoch = 500,
epochs = 20,
validation_data = val_gen,
validation_steps = val_steps
)
This is the only output I get, and it doesn't look like GPU is working on anything:
2020-06-10 11:18:15.459654: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
Epoch 1/20
1/500 [..............................] - ETA: 0s - loss: 1.0249
I tried running the parallel code in Python from this notebook and it ran smoothly, so I'm guessing it has something to do with R's version of Keras not being able to handle generator functions correctly.
I saw something about turning off multi-threading/processing in this thread. There is no use_multiprocessing
in R; there is a workers
argument that sounds similar, but it's already defaulted to 1. So it's unlikely to be this too. Pretty much at a dead end.
Upvotes: 1
Views: 335
Reputation: 1607
That's a known issue, please refer to https://github.com/rstudio/keras/issues/1090
One of the solutions that sometimes works is to wrap original generator from R with keras:::as_generator.function
function:
data_generator_py <- keras:::as_generator.function(data_generator)
Upvotes: 1