Keras hyperparameter autotune shortening the path

被刻印的时光 ゝ 提交于 2021-02-08 11:12:58

问题


this is the code that I am running. It is a self hyperparameter tuned ANN. The path is to long and I don't know how to shorten it.

def build_model(hp):
    model = keras.Sequential()
    for i in range(hp.Int('num_layers', 2, 20)):
        model.add(layers.Dense(units=hp.Int('units_' + str(i),
                                            min_value=32,
                                            max_value=512,
                                            step=32),
                               activation='relu'))
    model.add(layers.Dense(1, activation='linear'))
    model.compile(
        optimizer=keras.optimizers.Adam(
            hp.Choice('learning_rate', [1e-2, 1e-3, 1e-4])),
        loss='mean_absolute_error',
        metrics=['mean_absolute_error'])
    return model
    
tuner = RandomSearch(
    build_model,
    objective='val_mean_absolute_error',
    max_trials=5,
    executions_per_trial=3,
    directory='project',
    project_name='Air Quality Index')
 
tuner.search(X_train, y_train,
             epochs=5,
             validation_data=(X_test, y_test))

tuned_hyperparameters = pd.DataFrame(tuner.results_summary())

And this is the error that I am getting:

NotFoundError: Failed to create a NewWriteableFile: project\Air Quality Index\trial_adc2951b8eca485d8c1fc3c5d707051d\checkpoints\epoch_0\checkpoint_temp_6a28998a9e4a4dfe952d30328e5dbe23/part-00000-of-00001.data-00000-of-00001.tempstate7323650102596421360 : The system cannot find the path specified.
; No such process [Op:SaveV2]

When you try and create folder on that location with the name part-00000-of-00001.data-00000-of-00001.tempstate7323650102596421360 you can't make a folder. It says that name is to long for that location.

Can anyone pleas help me how to shorten the path name?

来源:https://stackoverflow.com/questions/65974699/keras-hyperparameter-autotune-shortening-the-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!