randy3k / radian

A 21 century R console
MIT License
2k stars 76 forks source link

Error when using keras #314

Open chisqr opened 2 years ago

chisqr commented 2 years ago

Hello,

I am trying to run the following keras tutorial: https://tensorflow.rstudio.com/tutorials/beginners/basic-ml/tutorial_basic_classification/

I get an error when running the following line in the tutorial:

> model %>% 
    layer_flatten(input_shape = c(28, 28)) %>% 
    layer_dense(units = 128, activation = 'relu') %>% 
    layer_dense(units = 10, activation = 'softmax')                                                                                                                                                                                                                                                              
<class 'SystemError'> <method 'seek' of '_io.StringIO' objects> returned a result with an error set

The error occurs only when I run the code within VS Code using the R extension. If I run the code in radian within the VS Code's bash terminal then the error does not occur. How can I fix this issues ?

I am using R v4.0.2, python 3.9.7 on linux.

Thanks

randy3k commented 2 years ago

um..to be honest, I have no idea what it is. Does the error show up after you hit enter or while you are typing?

chisqr commented 2 years ago

It happens after I press enter. The command runs properly and returns the correct answer, along with this message. I am using conda to create a python environment, then installing radian in it and then setting it up in the VS Code R extension.

mgendarme commented 2 years ago

Hi, I am getting this error too: <class 'SystemError'> <method 'seek' of '_io.StringIO' objects> returned a result with an error set after loading a pretrained model: testmod = load_model_hdf5(filepath = paste0(Save_dir, "/", modname), compile = F)

session info
``` r$> sessioninfo::session_info() - Session info ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- setting value version R version 4.1.1 (2021-08-10) os Windows 10 x64 system x86_64, mingw32 ui RTerm language (EN) collate English_Germany.1252 ctype English_Germany.1252 tz Europe/Berlin date 2021-10-07 - Packages -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- package * version date lib source abind 1.4-5 2016-07-21 [1] CRAN (R 4.1.1) assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.1.1) backports 1.2.1 2020-12-09 [1] CRAN (R 4.1.1) base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.1.1) BiocGenerics 0.38.0 2021-05-19 [1] Bioconductor bit 4.0.4 2020-08-04 [1] CRAN (R 4.1.1) bit64 4.0.5 2020-08-30 [1] CRAN (R 4.1.1) bitops 1.0-7 2021-04-24 [1] CRAN (R 4.1.1) broom 0.7.9 2021-07-27 [1] CRAN (R 4.1.1) cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.1.1) cli 3.0.1 2021-07-17 [1] CRAN (R 4.1.1) colorspace 2.0-2 2021-06-24 [1] CRAN (R 4.1.1) crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.1) DBI 1.1.1 2021-01-15 [1] CRAN (R 4.1.1) dbplyr 2.1.1 2021-04-06 [1] CRAN (R 4.1.1) digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.1) dplyr * 1.0.7 2021-06-18 [1] CRAN (R 4.1.1) EBImage * 4.34.0 2021-05-19 [1] Bioconductor ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.1) fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.1) fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.1) fftwtools 0.9-11 2021-03-01 [1] CRAN (R 4.1.1) forcats * 0.5.1 2021-01-27 [1] CRAN (R 4.1.1) fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.1) generics 0.1.0 2020-10-31 [1] CRAN (R 4.1.1) ggplot2 * 3.3.5 2021-06-25 [1] CRAN (R 4.1.1) glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.1) gtable 0.3.0 2019-03-25 [1] CRAN (R 4.1.1) haven 2.4.3 2021-08-04 [1] CRAN (R 4.1.1) hms 1.1.1 2021-09-26 [1] CRAN (R 4.1.1) htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1) htmlwidgets 1.5.4 2021-09-08 [1] CRAN (R 4.1.1) httr 1.4.2 2020-07-20 [1] CRAN (R 4.1.1) jpeg 0.1-9 2021-07-24 [1] CRAN (R 4.1.1) jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.1) keras * 2.6.1.9000 2021-10-07 [1] Github (rstudio/keras@76e6858) lattice 0.20-45 2021-09-22 [1] CRAN (R 4.1.1) lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1) locfit 1.5-9.4 2020-03-25 [1] CRAN (R 4.1.1) lubridate 1.7.10 2021-02-26 [1] CRAN (R 4.1.1) magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.1) Matrix 1.3-4 2021-06-01 [1] CRAN (R 4.1.1) modelr 0.1.8 2020-05-19 [1] CRAN (R 4.1.1) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.1.1) pillar 1.6.3 2021-09-26 [1] CRAN (R 4.1.1) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.1) png 0.1-7 2013-12-03 [1] CRAN (R 4.1.1) purrr * 0.3.4 2020-04-17 [1] CRAN (R 4.1.1) R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.1) Rcpp 1.0.7 2021-07-07 [1] CRAN (R 4.1.1) RCurl 1.98-1.5 2021-09-17 [1] CRAN (R 4.1.1) readr * 2.0.2 2021-09-27 [1] CRAN (R 4.1.1) readxl 1.3.1 2019-03-13 [1] CRAN (R 4.1.1) reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.1) reticulate 1.22-9000 2021-10-07 [1] Github (rstudio/reticulate@d98c60e) rlang 0.4.11 2021-04-30 [1] CRAN (R 4.1.1) rstudioapi * 0.13 2020-11-12 [1] CRAN (R 4.1.1) rvest 1.0.1 2021-07-26 [1] CRAN (R 4.1.1) scales 1.1.1 2020-05-11 [1] CRAN (R 4.1.1) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.1) stringi 1.7.5 2021-10-04 [1] CRAN (R 4.1.1) stringr * 1.4.0 2019-02-10 [1] CRAN (R 4.1.1) tensorflow 2.6.0.9000 2021-10-07 [1] Github (rstudio/tensorflow@1b75b20) tfruns 1.5.0 2021-02-26 [1] CRAN (R 4.1.1) tibble * 3.1.5 2021-09-30 [1] CRAN (R 4.1.1) tidyr * 1.1.4 2021-09-27 [1] CRAN (R 4.1.1) tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.1.1) tidyverse * 1.3.1 2021-04-15 [1] CRAN (R 4.1.1) tiff 0.1-8 2021-03-31 [1] CRAN (R 4.1.1) tzdb 0.1.2 2021-07-20 [1] CRAN (R 4.1.1) utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.1) vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.1) viridisLite * 0.4.0 2021-04-13 [1] CRAN (R 4.1.1) vroom 1.5.5 2021-09-14 [1] CRAN (R 4.1.1) whisker 0.4 2019-08-28 [1] CRAN (R 4.1.1) withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.1) xml2 1.3.2 2020-04-23 [1] CRAN (R 4.1.1) zeallot 0.1.0 2018-01-28 [1] CRAN (R 4.1.1) [1] C:/Users/Gendarme/Documents/R/R-4.1.1/library ```