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

Weird error with Ubuntu 18.04 install #12

Open
nateGeorge opened this issue Apr 16, 2019 · 3 comments
Open

Weird error with Ubuntu 18.04 install #12

nateGeorge opened this issue Apr 16, 2019 · 3 comments

Comments

@nateGeorge
Copy link

I'm getting a strange error when installing on Ubuntu 18.04. First, I installed R 3.5 following these instructions. Then I installed r-cran-devtools (sudo apt install r-cran-devtools). Then I installed deepviz with devtools::install_github("andrie/deepviz"). Finally, I tried to run an example:

library(deepviz)
library(magrittr)
require(keras)

model <- keras_model_sequential() %>%
  layer_dense(10, input_shape = 4) %>%
  layer_dense(2, activation = "sigmoid")

model %>% plot_model()

but it gave this error:

Error in data.frame(id = 1:n, type = type, label = label, stringsAsFactors = FALSE) : 
  arguments imply differing number of rows: 2, 0

The traceback() looks like this:

17: stop(gettextf("arguments imply differing number of rows: %s", 
        paste(unique(nrows), collapse = ", ")), domain = NA)
16: data.frame(id = 1:n, type = type, label = label, stringsAsFactors = FALSE)
15: dots_values(...)
14: flatten_bindable(dots_values(...))
13: dplyr::bind_cols(data.frame(id = 1:n, type = type, label = label, 
        stringsAsFactors = FALSE), extras)
12: create_node_df(n = length(model_layers), name = l_name, type = l_type, 
        label = glue::glue("{l_name}\n{l_type}\n{l_activation}"), 
        shape = "rectangle", activation = l_activation)
11: model_nodes(model)
10: plot_model.keras.engine.training.Model(.)
9: plot_model(.)
8: function_list[[k]](value)
7: withVisible(function_list[[k]](value))
6: freduce(value, `_function_list`)
5: `_fseq`(`_lhs`)
4: eval(quote(`_fseq`(`_lhs`)), env, env)
3: eval(quote(`_fseq`(`_lhs`)), env, env)
2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
1: model %>% plot_model()

So it appears to be happening on this line.

@nateGeorge
Copy link
Author

I think this might actually have to do with the recent release of the CRAN version of keras: https://github.com/rstudio/keras/releases

@nateGeorge
Copy link
Author

I think something changed with the way layers are accessed. This line in model_nodes no longer works:

model_layers <- x$get_config()$layers

@nateGeorge
Copy link
Author

Ok that was a saga to figure out, but it turns out the newest version of keras works like this: layers from a sequential model can be found from model$get_config(), but from the functional model, they are still model_layers <- model$get_config()$layers.

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

1 participant