python创建实例时显示没有参数-OSError无法创建文件无效参数
我在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"
總結
以上是生活随笔為你收集整理的python创建实例时显示没有参数-OSError无法创建文件无效参数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: qt 主动打开虚拟键盘_ipad键盘有用
- 下一篇: 设计企业网站大纲_哈尔滨企业网站设计费用