Open tlyim opened 6 years ago
That is strange. I just ran that example again without issue. It seems similar to this issue. The discussion suggests it may be a problem with RGui
(as opposed to RStudio
or running R
in terminal). Does that apply to you?
tried the suggestion at https://github.com/rstudio/keras/issues/33 by reinstalling reticulate
devtools::install_github("rstudio/reticulate", force = TRUE)
Also, tried reinstalling kerasformula:
devtools::install_github("rdrr1990/kerasformula", force = TRUE)
But unfortunately, the error persists.
Not sure if this is critical: I used R version 3.4.3 but kerasformula
was bulilt under v3.4.4. I got a warning when loading it.
I have another copy of RStudio (1.1.423, rather than 1.1.442) installed under Anaconda. It uses R version 3.4.3 as well. Interestingly, I cannot install the CRAN/GitHub version of kerasformlula there:
> install.packages("kerasformula")
Warning in install.packages :
package ‘kerasformula’ is not available (for R version 3.4.3)
> devtools::install_github("rdrr1990/kerasformula")
Downloading GitHub repo rdrr1990/kerasformula@master
from URL https://api.github.com/repos/rdrr1990/kerasformula/zipball/master
Installing kerasformula
"D:/ANACON~1/lib/R/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
"C:/Users/Administrator/AppData/Local/Temp/RtmpEBgL1S/devtools1b684bab2c3a/rdrr1990-kerasformula-a7253a4" \
--library="D:/Anaconda3/Lib/R/library" --install-tests
* installing *source* package 'kerasformula' ...
** R
** inst
** preparing package for lazy loading
Error : object 'use_session_with_seed' is not exported by 'namespace:keras'
ERROR: lazy loading failed for package 'kerasformula'
* removing 'D:/Anaconda3/Lib/R/library/kerasformula'
In R CMD INSTALL
Installation failed: Command failed (1)
Hmm... use_session_with_seed
is imported from the library keras
(and it is exported at least as of keras 2.16
). Have you confirmed keras
is working on that build? is_keras_available()
? Or, is there a chance that you are using an old version of keras
?
Unlikely. Just exploring all tools related to deep learning lately.
Please feel free to leave this aside for the moment. Could be more productive to follow up on if another user reports similar issues, making it easier to track the root cause.
I also suspect moving up to R v3.5 might solve the issue as most other packages would have to be updated at the same time. (But personally will wait for the first minor update to move up to v3.5+)
Anyway, thanks for looking into the issue. Appreciated.
@vsoch just asked in another thread--is python 2.7 a strict requirement for an older version of numpy? Here is what I'm hitting:
> out <- kms(as.factor(mpg) ~ ., mtcars)
Set session seed to 14218091
y appears categorical. Proceeding with classification.
Error in py_call_impl(callable, dots$args, dots$keywords) :
TypeError: '>' not supported between instances of 'NoneType' and 'float'
Detailed traceback:
File "/opt/conda/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/keras/layers/core.py", line 102, in __init__
self.rate = min(1., max(0., rate))
>
It also fails (higher level up) without the as.factor!
Thanks @rdrr1990 ! I am testing this now with the version that worked for you (2.7) and hopefully will have one of the two working!
Great! kerasformula
does a lot of data cleaning on the user's behalf in R
before handing off to python
--clearly there is some issue with 3.5
and higher that I need to track down.
Just a quick follow up - it works in 2.7! I'm finishing up the writeup, will hopefully have soon :)
@tlyim, fyi @vsoch had luck switching to Python 2.7
. Will let you when the root of the bug is flushed out, thanks again for your help!
All is good on my end, take a look here https://vsoch.github.io/lessons/keras-r/ let me know if anything needs tweaking and I'll share later today (Monday).
kms's default dense model in the imdb example code throws an error:
However, the lstm dense model executed with kms() runs perfectly fine.
I installed the current development version.