我在Tensorflow上面使用Python和Keras来训练我的神经网络。
当我从Ubuntu16.04切换到Windows10时,当我运行以下命令时,我的模型将无法保存: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和h5py2.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"