Error in Pre-trained Model Exploration

In BigGAN - objects section:
Failed to execute the following statement with error “No graph exists when eager execution is enabled.
module = hub.Module(module_path)

The complete stack trace is given below:

Loading BigGAN module from: https://tfhub.dev/deepmind/biggan-deep-256/1
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-9a2202fb01fe> in <module>()
      4 module_path = 'https://tfhub.dev/deepmind/biggan-deep-256/1'
      5 print('Loading BigGAN module from:', module_path)
----> 6 module = hub.Module(module_path)
      7 inputs = {k: tf.placeholder(v.dtype, v.get_shape().as_list(), k)
      8           for k, v in module.get_input_info_dict().items()}

6 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/saver.py in _import_meta_graph_with_return_elements(meta_graph_or_file, clear_devices, import_scope, return_elements, **kwargs)
   1475   """Import MetaGraph, and return both a saver and returned elements."""
   1476   if context.executing_eagerly():
-> 1477     raise RuntimeError("Exporting/importing meta graphs is not supported when "
   1478                        "eager execution is enabled. No graph exists when eager "
   1479                        "execution is enabled.")

RuntimeError: Exporting/importing meta graphs is not supported when eager execution is enabled. No graph exists when eager execution is enabled.

Hi @shehzikhan and welcome to the community

Try using hub.load() or hub.KerasLayer() instead of hub.Module

I hope it helps

Is it week1 assignment? I could not find the BigGAN section?

Hi, thanks for your reply.
Actually, it’s not in the week 1 assignment.
It’s in the “Pre-trained Model Exploration” section.

My bad, I should have linked the notebook before.

It worked fine in the workbook by tfhub.

I think I needed to refresh my workspace, it worked fine now.

Perhaps, this helps. According to this thread on the pytorch forum, the pretrained model was saved using something called nn.DataParallel , but the eval.py script will only do something with that if cuda is enabled.

And I have disabled it, because I don’t have cuda.

I managed to work around the loading of the model (with the help from the discussion on pytorch.org), but it still doesn’t work. I looked at the file some more, and I guess disabling cuda isn’t something that is actually supported.