有效:
model.save_weights(base_path + name[:89] + '_weights.h5')
不:
model.save_weights(base_path + name[:90] + '_weights.h5')
name[89:]
是什么,都会出错-但是name[:89]
一切都很好。唯一的罪魁祸首是savename长度,但这并没有反映在错误中——它和下面的其他细节。
有什么补救办法吗?谢谢你的帮助。
OSError: Unable to create file (unable to open file: name = '...', errno = 2,
error message = 'No such file or directory', flags = 13, o_flags = 302)
base_path = ("D:\\Desktop\\Database\\Deep Learning\\DL_code\\models_logs\\"
+ "M22__DCSEResNet_MP1_lr5_13.5k_124x2_cnndp.5_sncnndp.1_stagedp.5"
+ "__cnnsedp.2_preodp.5_Nadam_1e-4__max.507\\")
name = ("M22__DCSEResNet_MP1_lr5_13.5k_124x2_cnndp.5_sncnndp.1"
+ "_stagedp.5__cnnsedp.2_preodp.5_Nadam_1e-4__max.507_40vals")
name[:89] = ("M22__DCSEResNet_MP1_lr5_13.5k_124x2_cnndp.5_sncnndp.1"
+ "_stagedp.5__cnnsedp.2_preodp.5_Nadam")
len(base_path + name + '_weights.h5') = 279
len(base_path + name[:89] + '_weights.h5') = 259
几乎可以肯定这是2^8限制,但您的字符串可能有写为
\\
的反斜杠,因此它在260处断开,而不是在256处断开另外,愚蠢的我没有看到,或者你编辑了你的问题并添加了路径:你的反斜杠确实写为
\\
p.p.S.实际上是260 chars limitation
相关问题 更多 >
编程相关推荐