Keras: Location of .keras

Created on 20 Feb 2017  Â·  6Comments  Â·  Source: keras-team/keras

Can I set the location of .keras to be somewhere other than ~/, say and arbitrary location?
I would like to package my weights in a subfolder of the application not the user directory.
Thank you.

stale

All 6 comments

Why do you need to change the location of the .keras folder? If you take a look at the Keras sources (https://github.com/fchollet/keras/blob/25dbe8097fba9a6a429e19d0625d78c3b8731527/keras/backend/__init__.py#L18) you'll see that the base directory is set to your home directory.
I'm not sure if this can be changed.
As for packaging you weights, try doing something like this.

filepath="weights.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='loss', verbose=1, save_best_only=True, mode='min')
callbacks_list = [checkpoint]
model.fit(x, y, nb_epoch=10, batch_size=64, callbacks=callbacks_list)

Thanks for checkpoint/model location example.

On Wed, Feb 22, 2017 at 11:36 AM, Kirit Thadaka notifications@github.com
wrote:

Why do you need to change the location of the .keras folder? If you take a
look at the Keras sources (https://github.com/fchollet/keras/blob/
25dbe8097fba9a6a429e19d0625d78c3b8731527/keras/backend/__init__.py#L18)
you'll see that the base directory is set to your home directory.
I'm not sure if this can be changed.
As for packaging you weights, try doing something like this.

filepath="weights.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='loss', verbose=1, save_best_only=True, mode='min')
callbacks_list = [checkpoint]
model.fit(x, y, nb_epoch=10, batch_size=64, callbacks=callbacks_list)

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/fchollet/keras/issues/5462#issuecomment-281724130,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABXVTYkCYtVwtmhTuyPKQFXNWpva2Jy2ks5rfGQdgaJpZM4MGhbe
.

this may be another option

_keras_base_dir = os.path.expanduser('~')
if not os.access(_keras_base_dir, os.W_OK):
_keras_base_dir = '/tmp'

On Wed, Feb 22, 2017 at 11:36 AM, Kirit Thadaka
notifications@github.com wrote:

Why do you need to change the location of the .keras folder? If you take a
look at the Keras sources
(https://github.com/fchollet/keras/blob/25dbe8097fba9a6a429e19d0625d78c3b8731527/keras/backend/__init__.py#L18)
you'll see that the base directory is set to your home directory.
I'm not sure if this can be changed.
As for packaging you weights, try doing something like this.

filepath="weights.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='loss', verbose=1,
save_best_only=True, mode='min')
callbacks_list = [checkpoint]
model.fit(x, y, nb_epoch=10, batch_size=64, callbacks=callbacks_list)

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

Set the environment variable KERAS_HOME.

Why do you need to change the location of the .keras folder?

My /home partition is not large. My /data partition is over 1TB. I try to put everything on the /data partition.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkVdBergh picture MarkVdBergh  Â·  3Comments

anjishnu picture anjishnu  Â·  3Comments

zygmuntz picture zygmuntz  Â·  3Comments

farizrahman4u picture farizrahman4u  Â·  3Comments

braingineer picture braingineer  Â·  3Comments