mpezeshki / RNN_Experiments

General experiments on Vanilla RNN and LSTM in Theano.
16 stars 19 forks source link

ImportError: cannot import name RecurrentStack #3

Open andyyuan78 opened 9 years ago

andyyuan78 commented 9 years ago

ubgpu@ubgpu:~/github/RNN_Experiments$ sudo ./run_scripts/1xLSTM_100Units.sh [sudo] password for ubgpu: Using gpu device 0: GeForce GTX 970 Traceback (most recent call last): File "main.py", line 1, in from build_model_vanilla import build_model_vanilla File "/home/ubgpu/github/RNN_Experiments/build_model_vanilla.py", line 9, in from blocks.bricks.recurrent import SimpleRecurrent, RecurrentStack ImportError: cannot import name RecurrentStack ubgpu@ubgpu:~/github/RNN_Experiments$

I am sure I has block installed successful.

ubgpu@ubgpu:~/github/blocks$ sudo pip install git+git://github.com/mila-udem/blocks.git@stable -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt You are using pip version 7.0.3, however version 7.1.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command. /usr/local/lib/python2.7/dist-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Collecting git+git://github.com/mila-udem/blocks.git@stable Cloning git://github.com/mila-udem/blocks.git (to stable) to /tmp/pip-VVNyA8-build Requirement already satisfied (use --upgrade to upgrade): numpy==1.9.2 in /usr/local/lib/python2.7/dist-packages (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 1)) Requirement already satisfied (use --upgrade to upgrade): six==1.9.0 in /usr/local/lib/python2.7/dist-packages (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): pandas==0.16.1 in /usr/local/lib/python2.7/dist-packages (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 3)) Collecting progressbar2==2.7.3 (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 4)) /usr/local/lib/python2.7/dist-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading progressbar2-2.7.3.tar.gz Requirement already satisfied (use --upgrade to upgrade): PyYaml==3.11 in /usr/local/lib/python2.7/dist-packages (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 5)) Collecting toolz==0.7.2 (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 6)) Downloading toolz-0.7.2.tar.gz Collecting picklable-itertools==0.1.0 (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 7)) Downloading picklable-itertools-0.1.0.tar.gz Requirement already satisfied (use --upgrade to upgrade): theano from git+https://github.com/Theano/Theano.git@c6d2ab3929182cdf7cf12e4b1f191a6ff99d07cc#egg=theano in /usr/local/lib/python2.7/dist-packages (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 10)) Collecting fuel from git+https://github.com/mila-udem/fuel@stable#egg=fuel (from -r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 13)) Cloning https://github.com/mila-udem/fuel (to stable) to /tmp/pip-build-x2JIEU/fuel Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/lib/python2.7/dist-packages (from pandas==0.16.1->-r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 3)) Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/lib/python2.7/dist-packages (from pandas==0.16.1->-r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 3)) Requirement already satisfied (use --upgrade to upgrade): scipy>=0.11 in /usr/local/lib/python2.7/dist-packages (from theano->-r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 10)) Requirement already satisfied (use --upgrade to upgrade): h5py in /usr/lib/python2.7/dist-packages (from fuel->-r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 13)) Requirement already satisfied (use --upgrade to upgrade): tables in /usr/lib/python2.7/dist-packages (from fuel->-r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 13)) Requirement already satisfied (use --upgrade to upgrade): pyzmq in /usr/lib/python2.7/dist-packages (from fuel->-r https://raw.githubusercontent.com/mila-udem/blocks/stable/requirements.txt (line 13)) Building wheels for collected packages: progressbar2, toolz, picklable-itertools Running setup.py bdist_wheel for progressbar2 Stored in directory: /home/ubgpu/.cache/pip/wheels/77/f1/3f/c412babc8c9b4a577c877a5b7d9154f4d1208b2c668b882907 Running setup.py bdist_wheel for toolz Stored in directory: /home/ubgpu/.cache/pip/wheels/27/4c/fa/4ec16f8e5dd990fb99ed5da87aa2b50092f3efc0e41d56aca1 Running setup.py bdist_wheel for picklable-itertools Stored in directory: /home/ubgpu/.cache/pip/wheels/7d/37/8f/9b4d425f62d622b0123264a382f007c868ae4c1d3e26d9db05 Successfully built progressbar2 toolz picklable-itertools Installing collected packages: progressbar2, toolz, picklable-itertools, fuel, blocks Running setup.py install for fuel Running setup.py install for blocks Successfully installed blocks-0.0.1 fuel-0.0.1 picklable-itertools-0.1.0 progressbar2-2.7.3 toolz-0.7.2 ubgpu@ubgpu:~/github/blocks$

mpezeshki commented 9 years ago

Open ipython in terminal. Type from blocks.bricks.recurrent import SimpleRecurrent, RecurrentStack And see what happens.

andyyuan78 commented 9 years ago

I must use root to access theano, so...

ubgpu@ubgpu:~$ sudo ipython [sudo] password for ubgpu: Python 2.7.6 (default, Jun 22 2015, 17:58:13) Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.

In [1]: from blocks.bricks.recurrent import SimpleRecurrent, RecurrentStack

Using gpu device 0: GeForce GTX 970

ImportError Traceback (most recent call last)

in () ----> 1 from blocks.bricks.recurrent import SimpleRecurrent, RecurrentStack ImportError: cannot import name RecurrentStack In [2]:
EloiZ commented 9 years ago

Hi, RecurrentStack is a pretty new feature of blocks. (2 or 3 weeks old) Can you please make sure that you are working with the latest version of blocks?

andyyuan78 commented 9 years ago

after upgarde the blocks and fuel, change to python3:

ubgpu@ubgpu:~/github/RNN_Experiments$ sudo ./run_scripts/1xLSTM_100Units.sh Using gpu device 0: GeForce GTX 970 INFO:utils: ######################################## INFO:utils:"skip_connections" : True INFO:utils:"mini_batch_size_valid" : 1024 INFO:utils:"valid_path" : /data/lisatmp3/zablocki/valid.txt INFO:utils:"train_path" : /data/lisatmp3/zablocki/train.txt INFO:utils:"patience" : 20 INFO:utils:"dataset" : wikipedia INFO:utils:"interactive_mode" : False INFO:utils:"tot_num_char" : 50000 INFO:utils:"context" : 1 INFO:utils:"mlp_layers" : 1 INFO:utils:"monitoring_freq" : 500 INFO:utils:"clipping" : 5 INFO:utils:"learning_rate" : 0.001 INFO:utils:"generated_text_lenght" : 200 INFO:utils:"mlp_activation" : rectifier INFO:utils:"algorithm" : adam INFO:utils:"mini_batch_size" : 5 INFO:utils:"momentum" : 0.9 INFO:utils:"softmax_sampling" : random_sample INFO:utils:"layers" : 1 INFO:utils:"weight_noise" : 0.01 INFO:utils:"time_length" : 40 INFO:utils:"initial_text_length" : 60 INFO:utils:"load_path" : None INFO:utils:"state_dim" : 100 INFO:utils:"rnn_type" : simple INFO:utils:"save_path" : soft_text INFO:utils:########################################

Traceback (most recent call last): File "main.py", line 22, in time_length, args.tot_num_char) File "/home/ubgpu/github/RNN_Experiments/dataset.py", line 65, in get_minibatch_char data = get_data(dataset) File "/home/ubgpu/github/RNN_Experiments/dataset.py", line 12, in get_data path = os.path.join(config.data_path, 'wikipedia-text', File "/usr/local/lib/python3.4/dist-packages/fuel-0.0.1-py3.4.egg/fuel/config_parser.py", line 106, in getattr "provided: {}.".format(key)) fuel.config_parser.ConfigurationError: Configuration not set and no default provided: data_path. ubgpu@ubgpu:~/github/RNN_Experiments$

EloiZ commented 9 years ago

It seems like your data_path environment variable is not configured. You can have more infor about it in the "Quickstart" section of: http://fuel.readthedocs.org/en/latest/ Moreover, your datapath should point to a folder where you have your datasets. We are using Wikipedia and Penntree Bank datasets

andyyuan78 commented 9 years ago

for wikipedia data, Is this one? ubgpu@ubgpu:~/big_data$ ll buildMLpy_ch4_data -rw------- 1 ubgpu ubgpu 11476110198 12月 16 2014 enwiki-20141208-pages-articles.xml.bz2

where to got a free copy of 'Penntree Bank datasets'?