llSourcell/Music_Generator_Demo

AttributeError: 'module' object has no attribute 'While'

Closed this issue · 4 comments

I really enjoyed your video and wanted to try your code out myself. However, when running python rbm_chords.py I get the following output:

$ python rbm_chords.py 100%|███████████████████████████| 126/126 [00:03<00:00, 33.76it/s] 122 songs processed Traceback (most recent call last): File "rbm_chords.py", line 87, in <module> x_sample = gibbs_sample(1) File "rbm_chords.py", line 77, in gibbs_sample [_, _, x_sample] = control_flow_ops.While(lambda count, num_iter, *args: count < num_iter, AttributeError: 'module' object has no attribute 'While'

For me that looks like my tensorflow version is not the same this script expects or something.
I am running Tensorflow version 0.11.0rc0 in a virtualenv using Python 2.7.12.

Looking at the current Tensorflow repo, While does indeed not seem to be a part of control_flow_ops.py: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/control_flow_ops.py

Is your script maybe limited to an older version of Tensorflow?

Same issue here :( . A requirements.txt file would help.

I think this worked for me:

pip uninstall tensorflow
wget https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
pip install tensorflow-0.6.0-py2-none-any.whl

@KBoehme This has indeed fixed my problem. Thanks a lot!

after i did the above im getting the following erreor
sudo python rbm_chords.py Traceback (most recent call last): File "rbm_chords.py", line 7, in <module> import tensorflow as tf File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module> from tensorflow.python import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 50, in <module> from tensorflow.python.framework.framework_lib import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/framework_lib.py", line 62, in <module> from tensorflow.python.framework.ops import Graph File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 40, in <module> from tensorflow.python.framework import versions File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/versions.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> _pywrap_tensorflow = swig_import_helper() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) ImportError: /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header