Error loading the MNIST dataset in R using dataset_mnist()

31 Views Asked by At

I'm trying to read in the MNIST dataset using the following commands:

library(keras)
mnist <- dataset_mnist(path="/Users/xyz")

However, I had the error message that R session aborted due to a fatal error every time I run the codes: Error

Does anyone know what is causing this? Is it due to insufficient memory in my local R studio (2023.12.1+402 "Ocean Storm" Release)?

Btw, here are some additional version information:

keras: 2.13.0 R: 4.2.3 python: 3.11.7 MacOS: v11.1, 8GB memory

Thank you!

1

There are 1 best solutions below

0
jared_mamrot On

I wasn't able to replicate the issue (session crashing), but I'm able to load the mnist dataset using these steps:

library(keras)
install_keras()
use_virtualenv("r-tensorflow")
mnist <- dataset_mnist()

ls()
[1] "mnist"

str(mnist)
#> List of 2
#>  $ train:List of 2
#>   ..$ x: int [1:60000, 1:28, 1:28] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ y: int [1:60000(1d)] 5 0 4 1 9 2 1 3 1 4 ...
#>  $ test :List of 2
#>   ..$ x: int [1:10000, 1:28, 1:28] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ y: int [1:10000(1d)] 7 2 1 0 4 1 4 9 5 9 ...

If you run these commands, do you still have the same issue? Or new errors?


Session info:

sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.6.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Australia/Melbourne
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Matrix_1.6-5

loaded via a namespace (and not attached):
  [1] splines_4.3.0              later_1.3.2                bitops_1.0-7               tibble_3.2.1               janitor_2.2.0             
  [6] xts_0.13.1                 reprex_2.1.0               lifecycle_1.0.4            sf_1.0-15                  rstatix_0.7.2             
 [11] lattice_0.22-5             MASS_7.3-60.0.1            ggdist_3.3.1               backports_1.4.1            magrittr_2.0.3            
 [16] plotly_4.10.4              remotes_2.4.2.1            httpuv_1.6.13              sessioninfo_1.2.2          pkgbuild_1.4.3            
 [21] reticulate_1.34.0          cowplot_1.1.2              DBI_1.2.1                  ade4_1.7-22                keras_2.13.0              
 [26] lubridate_1.9.3            abind_1.4-5                pkgload_1.3.4              zlibbioc_1.48.0            Rtsne_0.17                
 [31] quadprog_1.5-8             purrr_1.0.2                BiocGenerics_0.48.1        RCurl_1.98-1.14            phyloseq_1.46.0           
 [36] GenomeInfoDbData_1.2.11    IRanges_2.36.0             KMsurv_0.1-5               S4Vectors_0.40.2           vegan_2.6-4               
 [41] units_0.8-5                microbiome_1.24.0          permute_0.9-7              codetools_0.2-19           Quandl_2.11.0             
 [46] tidyselect_1.2.0           farver_2.1.1               viridis_0.6.4              stats4_4.3.0               base64enc_0.1-3           
 [51] jsonlite_1.8.8             multtest_2.58.0            e1071_1.7-14               ellipsis_0.3.2             survival_3.5-8            
 [56] iterators_1.0.14           systemfonts_1.0.5          foreach_1.5.2              tools_4.3.0                ggnewscale_0.4.9          
 [61] Rcpp_1.0.12                glue_1.7.0                 gridExtra_2.3              bench_1.1.3                tfruns_1.5.1              
 [66] xfun_0.41                  mgcv_1.9-1                 TTR_0.24.4                 distributional_0.3.2       usethis_2.2.2             
 [71] GenomeInfoDb_1.38.5        dplyr_1.1.4                withr_3.0.0                BiocManager_1.30.22        fastmap_1.1.1             
 [76] rhdf5filters_1.14.1        fansi_1.0.6                digest_0.6.34              timechange_0.2.0           R6_2.5.1                  
 [81] mime_0.12                  colorspace_2.1-0           gtools_3.9.5               utf8_1.2.4                 tidyr_1.3.0               
 [86] generics_0.1.3             PerformanceAnalytics_2.0.4 data.table_1.15.0          class_7.3-22               httr_1.4.7                
 [91] htmlwidgets_1.6.4          whisker_0.4.1              pkgconfig_2.0.3            gtable_0.3.4               tensorflow_2.14.0         
 [96] XVector_0.42.0             survMisc_0.5.6             htmltools_0.5.7            carData_3.0-5              profvis_0.3.8             
[101] biomformat_1.30.0          scales_1.3.0               Biobase_2.62.0             png_0.1-8                  snakecase_0.11.1          
[106] knitr_1.45                 km.ci_0.5-6                rstudioapi_0.15.0          reshape2_1.4.4             uuid_1.2-0                
[111] nlme_3.1-164               curl_5.2.0                 proxy_0.4-27               cachem_1.0.8               zoo_1.8-12                
[116] rhdf5_2.46.1               stringr_1.5.1              KernSmooth_2.23-22         parallel_4.3.0             miniUI_0.1.1.1            
[121] tidyquant_1.0.7            pillar_1.9.0               grid_4.3.0                 vctrs_0.6.5                urlchecker_1.0.1          
[126] promises_1.2.1             ggpubr_0.6.0               car_3.1-2                  xtable_1.8-4               cluster_2.1.6             
[131] zeallot_0.1.0              cli_3.6.2                  compiler_4.3.0             rlang_1.1.3                crayon_1.5.2              
[136] ggsignif_0.6.4             survminer_0.4.9            classInt_0.4-10            plyr_1.8.9                 forcats_1.0.0             
[141] fs_1.6.3                   stringi_1.8.3              easi_0.2                   viridisLite_0.4.2          munsell_0.5.0             
[146] Biostrings_2.70.1          lazyeval_0.2.2             devtools_2.4.5             patchwork_1.2.0            ggplot2_3.4.4             
[151] Rhdf5lib_1.24.1            shiny_1.8.0                igraph_1.6.0               broom_1.0.5                memoise_2.0.1             
[156] quantmod_0.4.25            bit_4.0.5                  ape_5.7-1