According to documentation, it says that the default download directory for all Keras files is $HOME/.keras
. I'm using virtual environment and I want to change the default download directory of pre-trained models to a different directory. Maybe this has more to do with virtualenv than with Keras?
The Keras configuration file is a JSON file stored at $HOME/.keras/keras.json. The default configuration file looks like this: The image data format to be used as default by image processing layers and utilities (either channels_last or channels_first ). The epsilon numerical fuzz factor to be used to prevent division by zero in some operations.
There are two formats you can use to save an entire model to disk: the TensorFlow SavedModel format, and the older Keras H5 format . The recommended format is SavedModel. It is the default when you use model.save (). You can switch to the H5 format by: Passing save_format='h5' to save (). Passing a filename that ends in .h5 or .keras to save ().
This is legacy; nowadays there is only TensorFlow. Likewise, cached dataset files, such as those downloaded with get_file (), are stored by default in $HOME/.keras/datasets/ , and cached model weights files from Keras Applications are stored by default in $HOME/.keras/models/. How to do hyperparameter tuning with Keras?
How can I use pre-trained models in Keras? You could leverage the models available in keras.applications, or the models available on TensorFlow Hub . TensorFlow Hub is well-integrated with Keras. How can I use stateful RNNs?
If you are using the master branch of keras, you can set the KERAS_HOME
environment variable to set the cache directory. If it is not set, cache directory defaults to $HOME/.keras
.
export KERAS_HOME="/path/to/keras/dir"
Add the line to your ".bashrc" to set the variable every time you open up a new terminal.
This has not yet been released, you must use the master branch to use this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With