vanhuyz / CycleGAN-TensorFlow

An implementation of CycleGan using TensorFlow
MIT License
1.19k stars 436 forks source link

Use python train.py --load_model XXXX problem #121

Open lvjinqiao opened 4 years ago

lvjinqiao commented 4 years ago

I am not native English speaker. I hope you understand what I'm talking about。 When i use this command “ python train.py --load_model XXXX problem” to restore my Neural network model。 I got the following problems.

"***" Traceback (most recent call last): File "D:\python\lib\site-packages\tensorflow\python\framework\importer.py", line 497, in _import_graph_def_internal graph._c_graph, serialized, options) # pylint: disable=protected-access tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot add function '__inference_Dataset_map_Reader._parse_data_976' because a different function with the same name already exists.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 138, in tf.app.run() File "D:\python\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "D:\python\lib\site-packages\absl\app.py", line 299, in run _run_main(main, args) File "D:\python\lib\site-packages\absl\app.py", line 250, in _run_main sys.exit(main(argv)) File "train.py", line 134, in main train() File "train.py", line 83, in train restore = tf.train.import_meta_graph(meta_graph_path) File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 1462, in import_meta_graph kwargs)[0] File "D:\python\lib\site-packages\tensorflow\python\training\saver.py", line 1486, in _import_meta_graph_with_return_elements kwargs)) File "D:\python\lib\site-packages\tensorflow\python\framework\meta_graph.py", line 799, in import_scoped_meta_graph_with_return_elements return_elements=return_elements) File "D:\python\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "D:\python\lib\site-packages\tensorflow\python\framework\importer.py", line 405, in import_graph_def producer_op_list=producer_op_list) File "D:\python\lib\site-packages\tensorflow\python\framework\importer.py", line 501, in _import_graph_def_internal raise ValueError(str(e)) ValueError: Cannot add function '__inference_Dataset_map_Reader._parse_data_976' because a different function with the same name already exists. "*****" Do you know why? Thanks a lot. By the way By the way, I used tensorflow 2.0, so I modified a part of your code, but I only modified the generator、discriminator and reader