r-tensorflow / autokeras Goto Github PK
View Code? Open in Web Editor NEWPackage: R Interface to AutoKeras
Home Page: https://r-tensorflow.github.io/autokeras/
License: Other
Package: R Interface to AutoKeras
Home Page: https://r-tensorflow.github.io/autokeras/
License: Other
tried installing it on 2 separate machines, but I get the same error:
Error in install_keras(method = method, conda = conda, version = keras, : You should call install_keras() only in a fresh R session that has not yet initialized Keras and TensorFlow (this is to avoid DLL in use errors during installation)
Tried a couple of different things, creating new anaconda environments, reinstalling python, installing miniconda, etc.
I can install the keras and tensorflow packages separately w/o much problems, just the autokeras is an issue.
If you have any idea what to do would appreaciate it.
Dear Juan Cruz, I was wondering how to access the dropout rate for dropout layers selected for the best model obtained with the export_model function.
Thanks again for autokeras.
Hello,
I built my own autokeras
model, and it successfully ran and created an autokeras
model. Next, I exported and saved the model via the instructions in the vignette:
(keras_model <- export_model(akm1))
# And save the Keras model
keras::save_model_hdf5(keras_model, model_file)
However, when I try and reload the model with my_model <- keras::load_model_hdf5(model_file)
I get the following error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Unknown layer: IdentityLayer
Any insight or help would be appreciated!
> keras:::keras_version()
[1] ‘2.2.4’
> tensorflow:::tf_version()
[1] ‘2.0’
autokeras is now 0.4.0 .
autokeras 0.3.7 is depends tensorflow==1.12.0 but it's removed on pip or conda.
need to upgrade.
Hi,
Thanks for providing this interface in R. I am wondering if there is an easy way to set CPU to run autokeras?
Best,
Shixiang
I installed Autokeras using Docker and am attempting to use Autokeras in R, but I am unable to load the package.
I used the following commands to download Autokeras:
In terminal:
docker pull jcrodriguez1989/r-autokeras:0.1.0 docker run -it jcrodriguez1989/r-autokeras:0.1.0 /bin/bash
After doing this I was able to load the Autokeras package in R, but attempting to run the function model_text_classifier resulted in the following error:
Use the install_keras() function to install the core Keras library
Error: Error loading Python module keras
Because of this I tried the Autokeras install function in R:
remotes::install_github("jcrodriguez1989/autokeras", force=TRUE)
Since doing this I receive the following error whenever I attempt library(autokeras)
Error: package or namespace load failed for ‘autokeras’:
.onLoad failed in loadNamespace() for 'autokeras', details:
call: py_module_import(module, convert = convert)
error: ModuleNotFoundError: No module named 'autokeras'
I have also noticed that when I run reticulate::py_config() in R I receive the following output:
python: /Users/brianmoser/Library/r-miniconda/envs/r-reticulate/bin/python
libpython: /Users/brianmoser/Library/r-miniconda/envs/r-reticulate/lib/libpython3.8.dylib
pythonhome: /Users/brianmoser/Library/r-miniconda/envs/r-reticulate:/Users/brianmoser/Library/r-miniconda/envs/r-reticulate
version: 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:18:36) [Clang 10.0.1 ]
numpy: /Users/brianmoser/Library/r-miniconda/envs/r-reticulate/lib/python3.8/site-packages/numpy
numpy_version: 1.18.5
Although the version says (default, Jul 31 2020) I did not remember having Python 3.8 installed, and my default Python version when opening Python in the terminal is 3.6.10. I also see that Python 3.6.10 is saved in the base environment at /Users/brianmoser/opt/anaconda3/lib/python3.6, but is not saved in /Users/brianmoser/Libraryr-miniconda/envs/r-reticulate/lib/ folder.
Given all of this information, is there any clear solution to make Autokeras function in R? Is the problem associated with the presence of multiple versions of Python or is it something else?
Additional build info:
OS: macOS High Sierra 10.13.4
R: 3.6.3
RStudio: 1.2.5042
Hi,
Thank you for developing the "autokeras" package. It will definitely be a helpful tool for data scientists. I am trying to run the example for model_structured_data_regressor but I get errors with the 'evaluation' and 'export_model'. It appears that autokeras is unable to select the 'best' trained model
Below is the output of the code and my r session info
Any assistance is highly appreciated
Thank you,
Jacques
Predict with the best model
(predicted_y <- reg %>% predict(test_file_to_predict))
[,1]
[1,] 2.564118
[2,] 2.381873
[3,] 2.419431
[4,] 2.604501
[5,] 2.677018
[6,] 2.449875
[7,] 2.924572
[8,] 2.533927
[9,] 2.790744
[10,] 2.510988
[11,] 3.068361
[12,] 2.985615
[13,] 2.941829
[14,] 2.945893
[15,] 2.958850
[16,] 2.731235
[17,] 2.757782
[18,] 3.158206
[19,] 2.636754
[20,] 2.885813
[21,] 3.081780
[22,] 3.282970
[23,] 2.709834
[24,] 3.087875
[25,] 3.195198
[26,] 2.692371
[27,] 2.763576
[28,] 2.984694
[29,] 3.079619
[30,] 3.038662Evaluate the best model with testing data
reg %>% evaluate(test_file_to_eval, "Sepal.Length")
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
[[1]]
[1] 9.185607
1/1 [==============================] - 0s 67ms/step - loss: 9.1856 - mean_squared_error: 9.1856
[[2]]
[1] 9.185607
Get the best trained Keras model, to work with the keras R library
export_model(reg)
(keras_model <- export_model(reg))
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'TrackableWeightHandler' object has no attribute 'shape'
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reticulate_1.14 tfruns_1.4 tensorflow_2.0.0 keras_2.2.5.0 autokeras_1.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 zeallot_0.1.0 rappdirs_0.3.1 R6_2.4.1 jsonlite_1.6.1 magrittr_1.5 whisker_0.4 generics_0.0.2 tools_3.6.3
[10] xfun_0.12 yaml_2.2.1 compiler_3.6.3 base64enc_0.1-3 knitr_1.28
In model_image_classifier.R, model_image_regressor.R, model_structured_data_classifier.R, model_structured_data_regressor.R, model_text_classifier.R, model_text_regressor.R, I had to change the "name" parameter to "project_name" for it to be accepted by Python autokeras 1.0.12. I made these changes to R autokeras 1.0.1 source code and then packed everything back into a tar.gz which I then installed in R.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.