gpt4 book ai didi

keras - Colab Kerastuner 信息 :tensorflow:Reloading Oracle from existing project ./untitled_project/oracle.json

转载 作者:行者123 更新时间:2023-12-04 17:24:19 25 4
gpt4 key购买 nike

我在 Colab 上使用 kerastuner 时遇到了一些问题。这是我的代码:

def build_model(hp):
input_ = Input(shape=(20,20,1))
cnn_out1 = Conv2D(filters=16, kernel_size=hp.Int('kernel_size', 3, 7, step=2, default=3) , name='con1',
use_bias=True, activation = tf.nn.relu, kernel_regularizer=keras.regularizers.l2(0.01))(input_)
# cnn_out1 = keras.layers.BatchNormalization(epsilon=1e-6)
cnn_out = MaxPooling2D(pool_size=(2, 2))(cnn_out1)
cnn_out = keras.layers.Flatten()(cnn_out)
cnn_out = Dense(64, activation=tf.nn.relu, name='fc1', use_bias=True)(cnn_out)
cnn_out = keras.layers.Dropout(0.5)(cnn_out)
cnn_out = Dense(64, activation=tf.nn.relu, name='fc2', use_bias=True)(cnn_out)
#将CNN层命名为cnn_model供后期TimeDistributed调用
cnn_model = Model(inputs=input_, outputs=cnn_out)
cnn_model_map = Model(inputs=input_, outputs=cnn_out1)
# cnn_model.summary()
input_seq = Input(shape=(time_seq, 20, 20, 1))
processed_sequences = TimeDistributed(cnn_model)(input_seq)
# rnn_out = keras.layers.GRU(units=128, name='gru1', recurrent_dropout=0.5)(processed_sequences)
rnn_out = keras.layers.GRU(units=128, name='gru1')(processed_sequences)
# rnn_out = keras.layers.LSTM(units=128, name='lstm1')(processed_sequences)
rnn_out = keras.layers.Dropout(0.5)(rnn_out)
predictions = Dense(6, activation='softmax', name='fc3')(rnn_out)
rnn_model = Model(inputs = input_seq, outputs = predictions)
#rnn_model.summary()
rnn_model.compile(loss='categorical_crossentropy', optimizer='Nadam', metrics=['accuracy'])
return rnn_model
tuner = kt.Hyperband(
build_model,
objective = 'val_accuracy',
max_epochs=10,
hyperband_iterations=2
)
tuner.search(data, label_ohe, validation_split=0.1, epochs=30, shuffle='true', callbacks=[tf.keras.callbacks.EarlyStopping(patience=1)])

当我运行这段代码时,我得到以下提示

INFO:tensorflow:Reloading Oracle from existing project ./untitled_project/oracle.json
INFO:tensorflow:Reloading Tuner from ./untitled_project/tuner0.json
INFO:tensorflow:Oracle triggered exit

有人知道如何解决这个问题吗?

最佳答案

它告诉你该项目已经存在。在 tuner = kt.Hyperband(建筑模型,objective = 'val_accuracy',max_epochs=10,hyperband_iterations=2)

关于keras - Colab Kerastuner 信息 :tensorflow:Reloading Oracle from existing project ./untitled_project/oracle.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64403019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com