openai / glow

Code for reproducing results in "Glow: Generative Flow with Invertible 1x1 Convolutions"
https://arxiv.org/abs/1807.03039
MIT License
3.11k stars 515 forks source link

How to use pretrained model in current version of tensorflow2 with tensorflow.compat.v1? #102

Closed gitlabspy closed 3 years ago

gitlabspy commented 3 years ago

It throws error: "The name 'import/input/image:0' refers to a Tensor which does not exist. The operation, 'import/input/image', does not exist in the graph." I tried: changed tf.get_default_graph().get_tensor_by_name('import/' + name + ':0') into 'import/' + name + ':0' it works on loading model but it throws errors when using encode/decode: Cannot interpret feed_dict key as Tensor: The name 'import/input/image:0' refers to a Tensor which does not exist. The operation, 'import/input/image', does not exist in the graph.

Any way to make it work on tf2?

gitlabspy commented 3 years ago

Found it!

import tensorflow.compat.v1 as tf
tf.disable_eager_execution()
LeeeLiu commented 3 years ago

It throws error: "The name 'import/input/image:0' refers to a Tensor which does not exist. The operation, 'import/input/image', does not exist in the graph." I tried: changed tf.get_default_graph().get_tensor_by_name('import/' + name + ':0') into 'import/' + name + ':0' it works on loading model but it throws errors when using encode/decode: Cannot interpret feed_dict key as Tensor: The name 'import/input/image:0' refers to a Tensor which does not exist. The operation, 'import/input/image', does not exist in the graph.

Any way to make it work on tf2?

Hello, would you please share your trained checkpoints for 256×256? I am so GPU hungry. thanks a lot !!!