Comments (6)
Can you post a little more detail about your setup? What is the output of sessionInfo()
and reticulate::py_config()
? Also, what is the output from reticulate::py_last_error()
(what is the R traceback?)
If you're on Windows, I suspect you might be encountering some variation of this issue: rstudio/reticulate#1473. Alternatively, a more recent version of TensorFlow might now have more strict type promotion semantics.
The error message suggests that a well-placed tf$cast(x, "float32")
should fix the error.
from deep-learning-with-r-2nd-edition-code.
Thanks for looking into this! Sorry, I am on Fedora 38 Linux OS. Here are the outputs:
> reticulate::py_last_error()
── Python Exception Message ────────────────────────────────────────────────────
Traceback (most recent call last):
File "/home/maitra/.virtualenvs/r-reticulate/lib64/python3.11/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/maitra/.virtualenvs/r-reticulate/lib64/python3.11/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
except TypeError as e:
tensorflow.python.framework.errors_impl.NotFoundError: Graph execution error:
Detected at node 'ReadFile' defined at (most recent call last):
File "<string>", line 4, in fn
File "/usr/lib64/R/library/reticulate/python/rpytools/call.py", line 7, in python_function
value, error = rpycall.call_r_function(f, *args, **kwargs)
Node: 'ReadFile'
coast.jpg; No such file or directory
[[{{node ReadFile}}]] [Op:__inference_fn_5336]
── R Traceback ─────────────────────────────────────────────────────────────────
▆
1. └─reticulate (local) preprocess_image(base_image_path)
2. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
And here is:
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora Linux 38 (Thirty Eight)
Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS-OPENMP; LAPACK version 3.11.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/Chicago
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tensorflow_2.14.0 keras_2.13.0
loaded via a namespace (and not attached):
[1] backports_1.4.1 R6_2.5.1 base64enc_0.1-3 Matrix_1.6-4
[5] lattice_0.22-5 reticulate_1.34.0 magrittr_2.0.3 rappdirs_0.3.3
[9] png_0.1-8 generics_0.1.3 lifecycle_1.0.4 cli_3.6.1
[13] grid_4.3.2 zeallot_0.1.0 tfautograph_0.3.2 tfruns_1.5.1
[17] compiler_4.3.2 rprojroot_2.0.4 here_1.0.1 whisker_0.4.1
[21] Rcpp_1.0.11 rlang_1.1.2 jsonlite_1.8.7
And here is:
> reticulate::py_config()
python: /home/maitra/.virtualenvs/r-reticulate/bin/python
libpython: /usr/lib64/libpython3.11.so
pythonhome: /home/maitra/.virtualenvs/r-reticulate:/home/maitra/.virtualenvs/r-reticulate
version: 3.11.6 (main, Oct 3 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)]
numpy: /home/maitra/.virtualenvs/r-reticulate/lib/python3.11/site-packages/numpy
numpy_version: 1.24.3
tensorflow: /home/maitra/.virtualenvs/r-reticulate/lib64/python3.11/site-packages/tensorflow
What am I casting here with tf$cast(x, "float32")
? Where would I place this? Thank you again for your help!
from deep-learning-with-r-2nd-edition-code.
What version of TensorFlow and Keras are you using?
tensorflow::tf_config()
keras::keras$`__version__`
from deep-learning-with-r-2nd-edition-code.
Thank you again!
> tensorflow::tf_config()
TensorFlow v2.13.1 (~/.virtualenvs/r-reticulate/lib64/python3.11/site-packages/tensorflow)
Python v3.11 (~/.virtualenvs/r-reticulate/bin/python)
> keras::keras$`__version__`
Error in py_get_attr_impl(x, name, silent) :
AttributeError: module 'tensorflow.keras' has no attribute '__version__'
Run `reticulate::py_last_error()` for details.
I guess that is odd:
> reticulate::py_last_error()
── Python Exception Message ────────────────────────────────────────────────────
AttributeError: module 'tensorflow.keras' has no attribute '__version__'
── R Traceback ─────────────────────────────────────────────────────────────────
▆
1. ├─keras::keras$`__version__`
2. └─reticulate:::`$.python.builtin.module`(keras::keras, `__version__`)
3. └─reticulate:::`$.python.builtin.object`(x, name)
4. └─reticulate:::py_get_attr_or_item(x, name, TRUE)
5. └─reticulate::py_get_attr(x, name)
6. └─reticulate:::py_get_attr_impl(x, name, silent)
from deep-learning-with-r-2nd-edition-code.
See 5d666f9 for how to fix the error. Thank you for reporting!
from deep-learning-with-r-2nd-edition-code.
Thanks for looing into this!
from deep-learning-with-r-2nd-edition-code.
Related Issues (16)
- package installing error! HOT 5
- Tensor Type error with keras3 package but not keras HOT 10
- Issue downloading Kaggle dogs-vs-cats file HOT 4
- image_dataset_from_directory() error: 'size' must be a 1-D int32 Tensor HOT 2
- layer_random_flip() doesn't seem to like sequential layer HOT 4
- imagenet_preprocess_input() missing in keras3? HOT 7
- Using layer_lambda() with application_preprocess_inputs() HOT 4
- Mini Xception model differences when keras and keras3 packages are installed HOT 20
- Chapter 2.5.1 HOT 1
- installation problem HOT 13
- Plot(model) does not see graphviz in R on Windows HOT 1
- Installation problems
- "object 'optimizer' not found" error when fit() custom model HOT 4
- The data preparation question
- Chapter 3 Boston Housing Prices HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deep-learning-with-r-2nd-edition-code.