ml4a / ml4a

A python library and collection of notebooks for making art with machine learning.

Home Page:https://ml4a.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError in glow.load_model() in GLOW example

sh0w opened this issue · comments

hi there 🌸

i tried to run this notebook:

the error occured here:
glow.load_model(optimized=False)

output:


Loaded model

KeyError                                  Traceback (most recent call last)
<ipython-input-6-552a2674b3e4> in <module>()
      1 from ml4a.models import glow
      2 
----> 3 glow.load_model(optimized=False)
      4 glow.warm_start()  # optional: because the first run of the model takes a while, this conveniently gets it out of the way

4 frames
/usr/local/lib/python3.7/dist-packages/ml4a/models/glow.py in load_model(optimized)
    234 
    235     # Encoder
--> 236     enc_x = get_tensor(inputs['enc_x'])
    237     enc_eps = [get_tensor(outputs['enc_eps_' + str(i)]) for i in range(n_eps)]
    238     if not optimized:

/usr/local/lib/python3.7/dist-packages/ml4a/models/glow.py in get_tensor(name)
     28 
     29 def get_tensor(name):
---> 30     return tf.compat.v1.get_default_graph().get_tensor_by_name('import/' + name + ':0')
     31 
     32 

/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py in get_tensor_by_name(self, name)
   3781       raise TypeError("Tensor names are strings (or similar), not %s." %
   3782                       type(name).__name__)
-> 3783     return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
   3784 
   3785   def _get_tensor_by_tf_output(self, tf_output):

/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py in as_graph_element(self, obj, allow_tensor, allow_operation)
   3605 
   3606     with self._lock:
-> 3607       return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
   3608 
   3609   def _as_graph_element_locked(self, obj, allow_tensor, allow_operation):

/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py in _as_graph_element_locked(self, obj, allow_tensor, allow_operation)
   3647           raise KeyError("The name %s refers to a Tensor which does not "
   3648                          "exist. The operation, %s, does not exist in the "
-> 3649                          "graph." % (repr(name), repr(op_name)))
   3650         try:
   3651           return op.outputs[out_n]

KeyError: "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."

unfortunately, the GLOW notebook doesn't work on Colab right now due to Tensorflow version mismatch. no quick fix for it yet :*(