google-deepmind / deepmind-research

This repository contains implementations and illustrative code to accompany DeepMind publications
Apache License 2.0
13.07k stars 2.57k forks source link

Polygen Colab - Pretrained model execution fails #366

Open rkandas opened 2 years ago

rkandas commented 2 years ago

Hi, Executing sampling-pretrained.ipynb is failing in Colab with the following error messages

At Clone repo and import dependencies stage

Attempting uninstall: tensorflow
    Found existing installation: tensorflow 2.8.2+zzzcolab20220719082949
    Uninstalling tensorflow-2.8.2+zzzcolab20220719082949:
      Successfully uninstalled tensorflow-2.8.2+zzzcolab20220719082949
**ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
kapre 0.3.7 requires tensorflow>=2.0.0, but you have tensorflow 1.15.0 which is incompatible.**
Successfully installed bz2file-0.98 cloudpickle-1.1.1 dm-sonnet-1.36 gast-0.2.2 gevent-21.12.0 gunicorn-20.1.0 gym-0.12.5 h5py-2.10.0 keras-applications-1.0.8 kfac-0.2.4 mesh-tensorflow-0.1.21 pypng-0.20220715.0 semantic-version-2.10.0 tensor2tensor-1.14.0 tensorboard-1.15.0 tensorflow-1.15.0 tensorflow-estimator-1.15.1 tensorflow-gan-2.1.0 tensorflow-probability-0.8.0 zope.event-4.5.0 zope.interface-5.4.0
/tmp
Cloning into '/tmp/deepmind_research'...

At Generate class-conditional samples stage

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
[<ipython-input-4-f77c3522ad3c>](https://localhost:8080/#) in <module>()
     19     num_samples_batch, context=vertex_model_context,
     20     max_sample_length=max_num_vertices, top_p=top_p_vertex_model,
---> 21     recenter_verts=True, only_return_complete=True)
     22 vertex_model_saver = tf.train.Saver(var_list=vertex_model.variables)
     23 

5 frames
<__array_function__ internals> in prod(*args, **kwargs)

[/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/framework/ops.py](https://localhost:8080/#) in __array__(self)
    734   def __array__(self):
    735     raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy"
--> 736                               " array.".format(self.name))
    737 
    738   def __len__(self):

NotImplementedError: Cannot convert a symbolic Tensor (Minimum:0) to a numpy array.

Looks like the Tensorflow version and the dependencies got messed up. How to fix this?

Maro1 commented 1 year ago

This issue can be simply fixed by adding !pip install numpy==1.19.5 right before !pip install tensorflow==1.15 dm-sonnet==1.36 tensor2tensor==1.14 in the first code block.

hassanelkharroubi commented 1 year ago

@Maro1 Please which python version is implemented in this project? I'm facing a lot of problems Thanks

Maro1 commented 1 year ago

@Maro1 Please which python version is implemented in this project? I'm facing a lot of problems Thanks

Not sure but I have managed to get it running using Python 3.7 with the following dependencies:

dm-sonnet 1.32 tensorflow 1.14.0 tensor2tensor 1.15.7 numpy 1.21.6