我在Tensorflow上使用Python和Keras训练我的神经网络.
当我从Ubuntu 16.04切换到Windows 10时,运行以下命令无法再保存模型:
filepath = "checkpoint-"+str(f)+model_type+"-"+optimizer_name+"-{epoch:02d}-{loss:.3f}.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='loss', verbose=1, save_best_only=True, mode='min')
callbacks_list = [checkpoint]
后来:
model.fit(X, y,
batch_size=128,
epochs=1,
shuffle=False,
callbacks=callbacks_list)
我收到此错误:
OSError: Unable to create file (Unable to open file: name = ‘checkpoint-<_io.textiowrapper name="’data/swing-projects100-raw/many-chunks/log-gamma-f3.txt’" mode="’a’" encoding="’cp1252′">2l128-adam-0.001-{epoch:02d}-{loss:.3f}.h5′, errno = 22, error message = ‘invalid argument’, flags = 13, o_flags = 302)
我通过conda安装了Keras 2.0.8和h5py 2.7.0.
我试过了
filepath = "checkpoint-"+str(f)+model_type+"-"+optimizer_name+"-{epoch:02d}-{loss:.3f}.hdf5"
with open(filepath, "w") as f:
f.write("Test.")
并得到了类似的错误:
OSError: [Errno 22] Invalid argument: “checkpoint-<_io.textiowrapper name="’data/swing-projects100-raw/many-chunks/log-gamma-f3.txt’" mode="’a’" encoding="’cp1252′">2L128-Adam-0.001-{epoch:02d}-{loss:.3f}.hdf5”