Closed jonbry closed 7 months ago
I noticed on the example code on keras.posit.com uses the |>
pipe operator. I'm not sure if this is helpful, but when I switched to |>
I get the following regex output:
data_augmentation <- keras_model_sequential() |>
layer_random_flip("horizontal") |>
layer_random_rotation(0.1) |>
layer_random_zoom(0.2)
#> Error in layer_random_zoom(layer_random_rotation(layer_random_flip(keras_model_sequential(), : could not find function "layer_random_zoom"
Created on 2024-04-04 with reprex v2.1.0
The ValueError in console is the same.
As a side question: Is this the best repository to post these questions? I'm never sure where exactly to post issues that come up when working through the book. Should I be posting this in the keras repository?
I think this is another manifestation of #10.
The example code works without issue if only keras3
is loaded, but breaks if both keras
and keras3
are loaded. I'll aim to get a CRAN release of keras
and keras3
out next week to fix this.
For now, I would recommend uninstalling 'keras'
remove.packages("keras")
and restarting the R session. If keras
does end up accidentally loaded and you don't want to restart the session, you can temporarily "fix" the issue with this snippet:
assign(
"class_filters",
reticulate:::.globals$class_filters[-length(reticulate:::.globals$class_filters)],
envir = reticulate:::.globals
)
As a side question: Is this the best repository to post these questions?
Here or rstudio/keras
are both fine! Thanks for reporting issues!
For now, I would recommend uninstalling 'keras'
remove.packages("keras")
Thank you so much for getting back to me so quickly! This solved the issue. I didn't realize keras
could cause issues without me loading it directly.
I am working on the dog-cat model in Chapter 8, and I get the following error when trying to use
layer_random_flip()
with akeras_model_sequential()
:Created on 2024-04-04 with reprex v2.1.0
Here is the error:
The traceback:
I noticed the Python exception shows the package being
keras
and I confirmed that the version is 3.10.0. Let me know what information I can provide to help troubleshoot the issue.Thank you!