rstudio / keras3

R Interface to Keras
https://keras3.posit.co/
Other
833 stars 282 forks source link

Can't reproduce example #768

Closed Oakwilde closed 5 years ago

Oakwilde commented 5 years ago
> library(keras)
> mnist <- dataset_mnist()
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
11493376/11490434 [==============================] - 1s 0us/step
> x_train <- mnist$train$x
> y_train <- mnist$train$y
> x_test <- mnist$test$x
> y_test <- mnist$test$y
> x_train <- array_reshape(x_train, c(nrow(x_train), 784))
> x_test <- array_reshape(x_test, c(nrow(x_test), 784))
> # rescale
> x_train <- x_train / 255
> x_test <- x_test / 255
> y_train <- to_categorical(y_train, 10)
> model <- keras_model_sequential() 
> model %>% 
+   layer_dense(units = 256, activation = 'relu', input_shape = c(784)) %>% 
+   layer_dropout(rate = 0.4) %>% 
+   layer_dense(units = 128, activation = 'relu') %>%
+   layer_dropout(rate = 0.3) %>%
+   layer_dense(units = 10, activation = 'softmax')
Error in py_call_impl(callable, dots$args, dots$keywords) : 
  UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: 
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/training/checkpointable/base.py", line 442, in _method_wrapper
    method(self, *args, **kwargs)
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/sequential.py", line 180, in add
    output_tensor = layer(self.outputs[0])
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 554, in __call__
    outputs = self.call(inputs, *args, **kwargs)
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py", line 138, in call
    training = K.learning_phase()
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 385, in learning_phase
    return symbolic_learning
> model <- keras_model_sequential() 
> model %>% 
+   layer_dense(units = 256, activation = 'relu', input_shape = c(784)) %>% 
+   layer_dropout(rate = 0.4) %>% 
+   layer_dense(units = 128, activation = 'relu') %>%
+   layer_dropout(rate = 0.3) %>%
+   layer_dense(units = 10, activation = 'softmax')
Error in py_call_impl(callable, dots$args, dots$keywords) : 
  UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: 
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/training/checkpointable/base.py", line 442, in _method_wrapper
    method(self, *args, **kwargs)
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/sequential.py", line 180, in add
    output_tensor = layer(self.outputs[0])
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 554, in __call__
    outputs = self.call(inputs, *args, **kwargs)
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py", line 138, in call
    training = K.learning_phase()
  File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 385, in learning_phase
    return symbolic_learning
> 
dfalbel commented 5 years ago

Can you please share your sessionInfo() and tensorflow::tf_config()?

Oakwilde commented 5 years ago

Sure. Thanks.

Richard

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

[Workspace loaded from ~/.RData]

library(keras) mnist <- dataset_mnist() x_train <- mnist$train$x y_train <- mnist$train$y x_test <- mnist$test$x y_test <- mnist$test$y x_train <- array_reshape(x_train, c(nrow(x_train), 784)) x_test <- array_reshape(x_test, c(nrow(x_test), 784))

rescale

x_train <- x_train / 255 x_test <- x_test / 255 y_train <- to_categorical(y_train, 10) y_test <- to_categorical(y_test, 10) model <- keras_model_sequential() model %>%

  • layer_dense(units = 256, activation = 'relu', input_shape = c(784)) %>%
  • layer_dropout(rate = 0.4) %>%
  • layer_dense(units = 128, activation = 'relu') %>%
  • layer_dropout(rate = 0.3) %>%
  • layer_dense(units = 10, activation = 'softmax') Error in py_call_impl(callable, dots$args, dots$keywords) : UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/training/checkpointable/base.py", line 442, in _method_wrapper method(self, *args, *kwargs) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/sequential.py", line 180, in add output_tensor = layer(self.outputs[0]) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 554, in call outputs = self.call(inputs, args, **kwargs) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py", line 138, in call training = K.learning_phase() File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 385, in learning_phase return symbolic_learning

model %>% compile(

  • loss = 'categorical_crossentropy',
  • optimizer = optimizer_rmsprop(),
  • metrics = c('accuracy')
  • )

sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

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

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

other attached packages: [1] keras_2.2.4.1

loaded via a namespace (and not attached): [1] compiler_3.5.2 Matrix_1.2-17 magrittr_1.5 [4] R6_2.4.0 generics_0.0.2 tools_3.5.2 [7] whisker_0.3-2 base64enc_0.1-3 Rcpp_1.0.1 [10] reticulate_1.12 tensorflow_1.13.1 grid_3.5.2 [13] zeallot_0.1.0 jsonlite_1.6 tfruns_1.4 [16] lattice_0.20-38

tensorflow::tf_config() TensorFlow v1.13.1 (~/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow) Python v3.7 (~/anaconda3/envs/r-tensorflow/bin/python)

Richard Berk berkr@sas.upenn.edu

From: Daniel Falbel notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Saturday, May 4, 2019 at 8:32 AM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

Can you please share your sessionInfo() and tensorflow::tf_config()?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-489322900, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWULGIZEKR66QCLYR4LPTV64ZANCNFSM4HKXMLCQ.

Oakwilde commented 5 years ago

Sorry to bother you again but is it seems to be the same problem now with an example pasted from the keras_compile documentation. Thanks.

Richard

library(kerasR) if(keras_available()) {

  • X_train <- matrix(rnorm(100 * 10), nrow = 100)
  • Y_train <- to_categorical(matrix(sample(0:2, 100, TRUE), ncol = 1), 3)
  • mod <- Sequential()
  • mod$add(Dense(units = 50, input_shape = dim(X_train)[2]))
  • mod$add(Dropout(rate = 0.5))
  • mod$add(Activation("relu"))
  • mod$add(Dense(units = 3))
  • mod$add(ActivityRegularization(l1 = 1))
  • mod$add(Activation("softmax"))
  • keras_compile(mod, loss = 'categorical_crossentropy', optimizer = RMSprop())
  • keras_fit(mod, X_train, Y_train, batch_size = 32, epochs = 5,
  • verbose = 0, validation_split = 0.2)
  • } Error in py_call_impl(callable, dots$args, dots$keywords) : UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/keras/engine/sequential.py", line 181, in add output_tensor = layer(self.outputs[0]) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/keras/engine/base_layer.py", line 457, in call output = self.call(inputs, **kwargs) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/keras/layers/core.py", line 126, in call training=training) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 3105, in in_train_phase training = learning_phase() File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 135, in learning_phase name='keras_learning_phase') File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorfl

sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

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

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

other attached packages: [1] MASS_7.3-51.4 kerasR_0.6.1 tensorflow_1.13.1

loaded via a namespace (and not attached): [1] compiler_3.5.2 magrittr_1.5 Matrix_1.2-17 tools_3.5.2 [5] whisker_0.3-2 base64enc_0.1-3 Rcpp_1.0.1 reticulate_1.12 [9] grid_3.5.2 jsonlite_1.6 tfruns_1.4 lattice_0.20-38

tf_config() TensorFlow v1.13.1 (~/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow) Python v3.7 (~/anaconda3/envs/r-tensorflow/bin/python)

Richard Berk berkr@sas.upenn.edu

skeydan commented 5 years ago

For the first report, I can't really see why this is happening, as it should not with those package versions. In the second though I see

other attached packages: [1] MASS_7.3-51.4 kerasR_0.6.1 tensorflow_1.13.1

which indicates you have the - possibly conflicting - kerasR installed.

I suggest removing that package, and then, re-installing the current versions of reticulate, tensorflow and keras from CRAN.

Oakwilde commented 5 years ago

Hi,

I did as you suggested. I removed kerasR.

library(kerasR) Error in library(kerasR) : there is no package called ‘kerasR’

I then reinstalled, reticulate, keras, tensorflow.

Same problem remains. Here is code I pasted from https://keras.rstudio.com/articles/tutorial_basic_regression.html. This is what happened. I think I am defeated. ☹

library(keras) boston_housing <- dataset_boston_housing()

c(train_data, train_labels) %<-% boston_housing$train c(test_data, test_labels) %<-% boston_housing$test

library(tibble)

column_names <- c('CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT') train_df <- as_tibble(train_data) colnames(train_df) <- column_names

train_df

Test data is not used when calculating the mean and std.

Normalize training data

train_data <- scale(train_data)

Use means and standard deviations from training set to normalize test set

col_means_train <- attr(train_data, "scaled:center") col_stddevs_train <- attr(train_data, "scaled:scale") test_data <- scale(test_data, center = col_means_train, scale = col_stddevs_train)

train_data[1, ] # First training sample, normalized

build_model <- function() {

model <- keras_model_sequential() %>% layer_dense(units = 64, activation = "relu", input_shape = dim(train_data)[2]) %>% layer_dense(units = 64, activation = "relu") %>% layer_dense(units = 1)

model %>% compile( loss = "mse", optimizer = optimizer_rmsprop(), metrics = list("mean_absolute_error") )

model }

model <- build_model() model %>% summary()

Display training progress by printing a single dot for each completed epoch.

print_dot_callback <- callback_lambda( on_epoch_end = function(epoch, logs) { if (epoch %% 80 == 0) cat("\n") cat(".") } )

epochs <- 500

Fit the model and store training stats

history <- model %>% fit( train_data, train_labels, epochs = epochs, validation_split = 0.2, verbose = 0, callbacks = list(print_dot_callback) )

Error in py_call_impl(callable, dots$args, dots$keywords) : UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 880, in fit validation_steps=validation_steps) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 195, in model_iteration f = _make_execution_function(model, mode) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 122, in _make_execution_function return model._make_execution_function(mode) File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 1983, in _make_execution_function self._make_fit_function() File "/Users/RAB/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", l

sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

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

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

other attached packages: [1] keras_2.2.4.1 tibble_2.1.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.1 lattice_0.20-38 fansi_0.4.0 assertthat_0.2.1 utf8_1.1.4 [6] zeallot_0.1.0 crayon_1.3.4 grid_3.5.2 R6_2.4.0 jsonlite_1.6 [11] magrittr_1.5 pillar_1.3.1 cli_1.1.0 tfruns_1.4 rlang_0.3.4 [16] rstudioapi_0.10 whisker_0.3-2 Matrix_1.2-17 reticulate_1.12 generics_0.0.2 [21] tools_3.5.2 compiler_3.5.2 base64enc_0.1-3 pkgconfig_2.0.2 tensorflow_1.13.1

tensorflow::tf_config() TensorFlow v1.13.1 (~/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow) Python v3.7 (~/anaconda3/envs/r-tensorflow/bin/python)

Richard Berk berkr@sas.upenn.edu

From: Sigrid Keydana notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Monday, May 6, 2019 at 4:34 AM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

For the first report, I can't really see why this is happening, as it should not with those package versions. In the second though I see

other attached packages: [1] MASS_7.3-51.4 kerasR_0.6.1 tensorflow_1.13.1

which indicates you have the - possibly conflicting - kerasR installed.

I suggest removing that package, and then, re-installing the current versions of reticulate, tensorflow and keras from CRAN.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-489547080, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWXIRAOZKWRIDVRK74TPT7URVANCNFSM4HKXMLCQ.

BlueGrisGris commented 5 years ago

Hi!

I have reproduced this error:

Error in py_call_impl(callable, dots$args, dots$keywords) : UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/training/checkpointable/base.py", line 442, in _method_wrapper method(self, *args, *kwargs) File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/sequential.py", line 180, in add output_tensor = layer(self.outputs[0]) File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 554, in call outputs = self.call(inputs, args, **kwargs) File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py", line 138, in call training = K.learning_phase() File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 385, in learning_phase return symbolic_learning_phase() File "/anaconda3/envs/r-tensorflow/lib/

I have a freshly installed reticulate, keras, and tensorflow, and do not have kerasR installed. I am in version 3.60 of R.

Oakwilde commented 5 years ago

Thanks. I updated R to 3.6.0 and then reinstalled keras, reticulate, and tensorflow. I was hoping that with the updated R all would be well. Clearly a fantasy. Same error as before.

Richard Berk berkr@sas.upenn.edu

From: BlueGrisGris notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Monday, May 6, 2019 at 8:07 PM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

Hi!

I have reproduced this error:

Error in py_call_impl(callable, dots$args, dots$keywords) : UnboundLocalError: local variable 'a' referenced before assignment

Detailed traceback: File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/training/checkpointable/base.py", line 442, in _method_wrapper method(self, *args, *kwargs) File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/sequential.py", line 180, in add output_tensor = layer(self.outputs[0]) File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 554, in call outputs = self.call(inputs, args, **kwargs) File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/layers/core.py", line 138, in call training = K.learning_phase() File "/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 385, in learning_phase return symbolic_learning_phase() File "/anaconda3/envs/r-tensorflow/lib/

I have a freshly installed reticulate, keras, and tensorflow, and do not have kerasR installed. I am in version 3.60 of R.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-489831032, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWXCPL6Z3WD7G43CKKTPUDB2HANCNFSM4HKXMLCQ.

skeydan commented 5 years ago

This is pretty mysterious to me as with the CRAN versions of tensorflow and keras, and with TF release 1.13.1, this should not happen. Can you indicate the output of

tensorflow::tf_config()
sys <- reticulate::import("sys")
sys$path
Oakwilde commented 5 years ago

Here is a complete story with in addition the output you requested at the bottom. I pasted the code from https://keras.rstudio.com/articles/tutorial_basic_regression.html including code that was not formally needed for keras. I am on a different Mac – this one is at work the other is at home – and I reinstalled reticulate, keras and tensorflow. I updated R. Same problem.

library(keras) boston_housing <- dataset_boston_housing()

c(train_data, train_labels) %<-% boston_housing$train c(test_data, test_labels) %<-% boston_housing$test

paste0("Training entries: ", length(train_data), ", labels: ", length(train_labels))

train_data[1, ] # Display sample features, notice the different scales

library(tibble)

column_names <- c('CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT') train_df <- as_tibble(train_data) colnames(train_df) <- column_names

train_df

train_labels[1:10] # Display first 10 entries

train_data <- scale(train_data)

col_means_train <- attr(train_data, "scaled:center") col_stddevs_train <- attr(train_data, "scaled:scale") test_data <- scale(test_data, center = col_means_train, scale = col_stddevs_train)

train_data[1, ] # First training sample, normalized

build_model <- function() {

model <- keras_model_sequential() %>% layer_dense(units = 64, activation = "relu", input_shape = dim(train_data)[2]) %>% layer_dense(units = 64, activation = "relu") %>% layer_dense(units = 1)

model %>% compile( loss = "mse", optimizer = optimizer_rmsprop(), metrics = list("mean_absolute_error") )

model }

model <- build_model() model %>% summary()

Display training progress by printing a single dot for each completed epoch.

print_dot_callback <- callback_lambda( on_epoch_end = function(epoch, logs) { if (epoch %% 80 == 0) cat("\n") cat(".") } )

epochs <- 500

Fit the model and store training stats

history <- model %>% fit( train_data, train_labels, epochs = epochs, validation_split = 0.2, verbose = 0, callbacks = list(print_dot_callback) )

sessionInfo()

)

Error in py_call_impl(callable, dots$args, dots$keywords) : UnboundLocalError: local variable 'a' referenced before assignment

sessionInfo() R version 3.6.0 (2019-04-26) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding

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

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

other attached packages: [1] tibble_2.1.1 keras_2.2.4.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.1 lattice_0.20-38 fansi_0.4.0 assertthat_0.2.1 utf8_1.1.4 [6] crayon_1.3.4 zeallot_0.1.0 grid_3.6.0 R6_2.4.0 jsonlite_1.6 [11] magrittr_1.5 pillar_1.3.1 cli_1.1.0 rlang_0.3.4 tfruns_1.4 [16] rstudioapi_0.10 whisker_0.3-2 Matrix_1.2-17 reticulate_1.12 generics_0.0.2 [21] tools_3.6.0 compiler_3.6.0 pkgconfig_2.0.2 base64enc_0.1-3 tensorflow_1.13.1

tensorflow::tf_config function () { have_tensorflow <- py_module_available("tensorflow") config <- py_config() if (have_tensorflow) { if (reticulate::py_has_attr(tf, "version")) version_raw <- tf$version$VERSION else version_raw <- tf$VERSION tfv <- strsplit(version_raw, ".", fixed = TRUE)[[1]] version <- package_version(paste(tfv[[1]], tfv[[2]], sep = ".")) structure(class = "tensorflow_config", list(available = TRUE, version = version, version_str = version_raw, location = config$required_module_path, python = config$python, python_version = config$version)) } else { structure(class = "tensorflow_config", list(available = FALSE, python_versions = config$python_versions, error_message = tf_config_error_message())) } } <bytecode: 0x120d29930>

sys<-reticulate::import("sys") sys$path [1] "" [2] "/Users/berkr/anaconda3/envs/r-tensorflow/bin" [3] "/Users/berkr/anaconda3/envs/r-tensorflow/lib/python37.zip" [4] "/Users/berkr/anaconda3/envs/r-tensorflow/lib/python3.7" [5] "/Users/berkr/anaconda3/envs/r-tensorflow/lib/python3.7/lib-dynload" [6] "/Users/berkr/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages" [7] "/Users/berkr/Library/R/3.6/library/reticulate/python" [8] "/Users/berkr/Library/R/3.6/library/keras/python"

Richard Berk berkr@sas.upenn.edu

From: Sigrid Keydana notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Tuesday, May 7, 2019 at 8:13 AM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

This is pretty mysterious to me as with the CRAN versions of tensorflow and keras, and with TF release 1.13.1, this should not happen. Can you indicate the output of

tensorflow::tf_config()

sys <- reticulate::import("sys")

sys$path

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-490053966, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWWCJJGGU5K7OEIRNZTPUFW7VANCNFSM4HKXMLCQ.

skeydan commented 5 years ago

sorry, it should have said

tensorflow::tf_config()
Oakwilde commented 5 years ago

Sorry. I should have caught that.

tensorflow::tf_config() TensorFlow v1.13.1 (~/anaconda3/envs/r-tensorflow/lib/python3.7/site-packages/tensorflow) Python v3.7 (~/anaconda3/envs/r-tensorflow/bin/python)

Richard Berk berkr@sas.upenn.edu

From: Sigrid Keydana notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Tuesday, May 7, 2019 at 11:46 AM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

sorry, it should have said

tensorflow::tf_config()

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-490136523, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWU5GNQQ66U6I5CAX4LPUGP55ANCNFSM4HKXMLCQ.

skeydan commented 5 years ago

thanks! Honestly still a puzzle, but just to get working, installing the nightly really should help:

install_tensorflow(version = "nightly")

does it?

Oakwilde commented 5 years ago

Still bad news when I tried to re-run the example I sent you. But the error message is different and maybe has some clues. I got that message after the fitting step was called.

WARNING: Logging before flag parsing goes to stderr. W0507 14:07:13.324410 4393981376 lazy_loader.py:50] WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see:

2019-05-07 14:07:13.438965: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA

Richard Berk berkr@sas.upenn.edu

From: Sigrid Keydana notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Tuesday, May 7, 2019 at 1:46 PM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

install_tensorflow(version = "nightly")

skeydan commented 5 years ago

these are all "informational" - was the model fitted successfully?

Oakwilde commented 5 years ago

YES! I saw it doing something, but those informational warnings threw me. I was able to reproduce the results from the website I was working from. So, like a vitamin, I do this once a day? That is plenty good enough for now. Thanks.

Richard Berk berkr@sas.upenn.edu

From: Sigrid Keydana notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Tuesday, May 7, 2019 at 2:18 PM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

these are all "informational" - was the model fitted successfully?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-490191919, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWXRLYKCGTHOE47OGNTPUHBVTANCNFSM4HKXMLCQ.

skeydan commented 5 years ago

So, like a vitamin, I do this once a day?

LOL :-)

I guess unless you need the new bleeding-edge features every day, you could stick with this build for a while :-)

Oakwilde commented 5 years ago

Hi,

It’s me again. Sorry.

I have python 3.7.3. Seems to be looking for Python3.8.6 and conda does not appear to be happy. And yet, 3.6.8 is downloaded. Error message at the end. As before, help is always appreciated.

Richard

library(keras)

library(tensorflow)

install_tensorflow(version = "nightly")

Creating r-tensorflow conda environment for TensorFlow installation...

Collecting package metadata: ...working... done

Solving environment: ...working... done

Package Plan

environment location: /Users/RAB/anaconda3/envs/r-tensorflow

added / updated specs:

- python=3.6

The following packages will be downloaded:

package                    |            build

---------------------------|-----------------

python-3.6.8               |       haf84260_0        20.5 MB

------------------------------------------------------------

                                       Total:        20.5 MB

The following NEW packages will be INSTALLED:

ca-certificates pkgs/main/osx-64::ca-certificates-2019.1.23-0

certifi pkgs/main/osx-64::certifi-2019.3.9-py36_0

libcxx pkgs/main/osx-64::libcxx-4.0.1-hcfea43d_1

libcxxabi pkgs/main/osx-64::libcxxabi-4.0.1-hcfea43d_1

libedit pkgs/main/osx-64::libedit-3.1.20181209-hb402a30_0

libffi pkgs/main/osx-64::libffi-3.2.1-h475c297_4

ncurses pkgs/main/osx-64::ncurses-6.1-h0a44026_1

openssl pkgs/main/osx-64::openssl-1.1.1b-h1de35cc_1

pip pkgs/main/osx-64::pip-19.1-py36_0

python pkgs/main/osx-64::python-3.6.8-haf84260_0

readline pkgs/main/osx-64::readline-7.0-h1de35cc_5

setuptools pkgs/main/osx-64::setuptools-41.0.1-py36_0

sqlite pkgs/main/osx-64::sqlite-3.28.0-ha441bb4_0

tk pkgs/main/osx-64::tk-8.6.8-ha441bb4_0

wheel pkgs/main/osx-64::wheel-0.33.1-py36_0

xz pkgs/main/osx-64::xz-5.2.4-h1de35cc_4

zlib pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3

Downloading and Extracting Packages

python-3.6.8 | 20.5 MB | ########## | 100%

CondaFileIOError: '/Users/RAB/anaconda3/pkgs/python-3.6.8-haf84260_0.tar.bz2'. contains unsafe path: lib/python3.6/config-3.6m-darwin/config.c.in

Error: Error 1 occurred creating conda environment r-tensorflow

skeydan commented 5 years ago

the error message is missing... anyway, I suggest waiting until

https://github.com/rstudio/tensorflow/pull/322

is merged - after that you'll get python 3.7 in a default conda installation of "nightly".

Oakwilde commented 5 years ago

Sorry about the lack of an error message. I thought it was pasted in. But, good advice. Thanks.

Richard Berk berkr@sas.upenn.edu

From: Sigrid Keydana notifications@github.com Reply-To: rstudio/keras reply@reply.github.com Date: Friday, May 10, 2019 at 12:11 PM To: rstudio/keras keras@noreply.github.com Cc: "Berk, Richard A" berkr@sas.upenn.edu, Author author@noreply.github.com Subject: Re: [rstudio/keras] Can't reproduce example (#768)

the error message is missing... anyway, I suggest waiting until

rstudio/tensorflow#322https://github.com/rstudio/tensorflow/pull/322

is merged - after that you'll get python 3.7 in a default conda installation of "nightly".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rstudio/keras/issues/768#issuecomment-491344197, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHFKAWTWIJHFUNXSCPURNYTPUWNBZANCNFSM4HKXMLCQ.