Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in py_call_impl(callable, dots$args, dots$keywords)... #238

Closed
faltinl opened this issue Apr 20, 2018 · 4 comments
Closed

Error in py_call_impl(callable, dots$args, dots$keywords)... #238

faltinl opened this issue Apr 20, 2018 · 4 comments

Comments

@faltinl
Copy link

faltinl commented Apr 20, 2018

The following program has been run flawlessly with my previous setup using keras 2.1.2., kerasR 0.6.1. and tensorflow 1.4.3. :

library(kerasR)
library(keras)
model <- keras_model_sequential() %>%
  layer_dense(units = 32, activation = "relu", input_shape = c(64)) %>%
  layer_dense(units = 32, activation = "relu") %>%
  layer_dense(units = 10, activation = "softmax")

model %>% compile(
  optimizer = "rmsprop",
  loss = "categorical_crossentropy",
  metrics = c("accuracy")
)

x_train <- array(runif(1000 * 64), dim = c(1000, 64))
y_train <- array(runif(1000 * 10), dim = c(1000, 10))

model %>% fit(
  x_train,
  y_train,
  epochs = 10, # exchange to <10 to initiate a real-time display in viewer pane!
  batch_size = 128,
  verbose = 2,
  view_metrics = "auto",
  validation_split = 0.2)

After updating to tensorflow 1.5.0.9000 via devtools::install_github("rstudio/tensorflow") without noticing any problems, followed by

library(tensorflow)
install_tensorflow()

the short test with

sess = tf$Session()
hello <- tf$constant('Hello, TensorFlow!')
sess$run(hello)

was passed ok. Upon running the above NN program the following error message , shown with the 2 uppermost traceback items was obtained:

 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  TypeError: update() takes from 2 to 3 positional arguments but 4 were given 

12. | stop(structure(list(message = "TypeError: update() takes from 2 to 3 positional arguments but 4 were
 given",      call = py_call_impl(callable, dots$args, dots$keywords),      cppstack = structure(list(file = "",
 line = -1L, stack = "C++ stack not available on this system"), .Names = c("file",      "line", "stack"), class =
 "Rcpp_stack_trace")), .Names = c("message",  ...
11.
(structure(function (...) 
{
    dots <- py_resolve_dots(list(...))
    result <- py_call_impl(callable, dots$args, dots$keywords) ... 
etc.

Several completely different models (using a very diverse choice of architectures) which were running flawlessly with my previous tensorflow-installation all failed at the same point of the fit()-process, showing almost the same message text in all cases.

In the meantime I have removed tensorflow 1.5.0., then repeated the installation process - with identical results.

Any ideas what could be wrong? => Tnx in advance!

@jjallaire
Copy link
Member

This was an issue introduced in Keras 2.1.4 which we've since resolved in the R keras package, see rstudio/keras3#285

So if you update the R keras package to the latest version from CRAN then the error should go away.

@faltinl
Copy link
Author

faltinl commented Apr 20, 2018

Tnx for info. However, when trying to install.packages("keras") as indicated at CRAN, it is installing v2.1.2. again. If, however, I try to install.packages("keras 2.1.5") I keep getting

Warning in install.packages :
  package ‘keras 2.1.5’ is not available (for R version 3.4.3)

...which is, indeed, my version of R I have installed presently.

Finally, using devtools::install_github("rstudio/keras") led to installation of keras 2.1.5.9001 - and now both the sample program above as well as one of the other programms mentioned worked smoothly. Thanks for all the hints!

@jjallaire
Copy link
Member

The current version of keras on CRAN is v2.1.5: https://cran.r-project.org/web/packages/keras/index.html

You must be using a CRAN mirror that has an older snapshot of the package.

Glad you figured out the devtools workaround!

@faltinl
Copy link
Author

faltinl commented Apr 21, 2018

Well - I used https://mran.microsoft.com/package/keras, where version 2.1.5, published 2018-03-25 is announced. However, upon installing as indicated, the whole process as described in my last post starts again. (I just repeated it, alas...). Only from devtools::install_github("rstudio/keras") I am able to get a working installation.
Thanks anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants