rstudio / tensorflow.rstudio.com

https://tensorflow.rstudio.com
9 stars 12 forks source link

keras dataset won't load- using R #69

Closed LeticiaAuu closed 9 months ago

LeticiaAuu commented 10 months ago

In R: Tensorflow installed correctly (tested and received the output expected). The folder where cache data is stored doesn't include models folder, and has empty datasets folder. C:\Users\My_user_name.keras\datasets.

installed keras several times. no change.

library(keras) mnist <- dataset_mnist() error received:

Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz Error in 1L:(nrow(t) - trim_tail) : argument of length 0

t-kalinowski commented 10 months ago

Can you please provide a traceback()? I don't see the same error.

LeticiaAuu commented 10 months ago

traceback () 4: get_r_trace(TRUE, 1L) 3: py_call_impl(callable, call_args$unnamed, call_args$named) 2: keras$datasets$mnist$load_data(path) 1: dataset_mnist()

It may be a path issue but unclear how to define the path for keras and the dataset doesn't seem to exist on my local machine.

t-kalinowski commented 9 months ago

If you're encountering something like that that seems like an installation issue, this series of steps is usually a good way to get unstuck:

# install the development version of R packages
remotes::install_github("rstudio/reticulate")
remotes::install_github("rstudio/tensorflow")
remotes::install_github("rstudio/keras")

# install Python, ideally a version that about 2 minor versions behind the current
# release version
reticulate::install_python("3.10:latest")

# install keras and tensorflow
keras3::install_keras(backend = "tensorflow")

If any of this produces an error, please report back with the full output of what you see.