photoshop的train.py不能保存模型文件:generator_weight

来源:8-4 如何学习一门技术及课程知识点总结

卖破烂的0

2018-10-16

  1. 环境:macbook10.12.6 (16G29),python2.7,virtualenv.
  2. 描述:下载了老师的train.py跑,到Epoch 9, 第 22 步, 生成器的损失: 1.945, 判别器的损失: 1.434之后报错如下,google不到原因,程序也推出了。
  3. 错误内容:

WARNING:tensorflow:This model was compiled with a Keras optimizer (<tensorflow.python.keras.optimizers.Adam object at 0x1310a1350>) but is being saved in TensorFlow format withsave_weights. The model's weights will be saved, but unlike with TensorFlow optimizers in the TensorFlow format the optimizer's state will not be saved.

Consider using a TensorFlow optimizer fromtf.train. 2018-10-16 12:50:29.019043: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at save_restore_v2_ops.cc:109 : Not found: ; No such file or directory Traceback (most recent call last): File "train.py", line 92, in <module> train() File "train.py", line 87, in train g.save_weights("generator_weight1016", True) File "/Users/hahaxixi2017/PycharmProjects/tensorflow/lib/python2.7/site-packages/tensorflow/python/keras/engine/network.py", line 1458, in save_weights self._checkpointable_saver.save(filepath, session=session) File "/Users/hahaxixi2017/PycharmProjects/tensorflow/lib/python2.7/site-packages/tensorflow/python/training/checkpointable/util.py", line 1309, in save global_step=checkpoint_number) File "/Users/hahaxixi2017/PycharmProjects/tensorflow/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1450, in save raise exc ValueError: Parent directory of generator_weight doesn't exist, can't save.

写回答

3回答

一介白丁

2018-12-12

我也遇到这个问题,请问最后是怎么解决的?

0
3
卖破烂的0
回复
一介白丁
恩,感谢,弄成这样就可以了
2018-12-13
共3条回复

慕移动3492956

2018-12-11

我也遇到这个问题

0
0

Oscar

2018-10-18

你是不是修改过我的代码?

你的 train.py 的存放路径是什么?

看这里错误信息是因为找不到存放 generator_weight 的上级目录。

g.save_weights("generator_weight1016", True)

你改了一些代码是吧?

0
1
卖破烂的0
没有改改代码,train.py就是在虚拟环境的根目录。和network.py,images文件夹在同一级目录
2018-10-18
共1条回复

基于Python玩转人工智能最火框架 TensorFlow应用实践

机器学习入门,打牢TensorFlow框架应用是关键!

2214 学习 · 688 问题

查看课程