rkadlec / asreader

This is an implementation of the Attention Sum Reader model as presented in "Text Comprehension with the Attention Sum Reader Network" available at http://arxiv.org/abs/1603.01547.
Other
95 stars 32 forks source link

ValueError: Variables must have names: [Elemwise{second,no_inplace}.0] #7

Open SeekPoint opened 7 years ago

SeekPoint commented 7 years ago

rzai@rzai00:~/prj/asreader/asreader$ bash quick-start-cbt-ne.sh 2>&1 > tee yknote---quick-start-cbt-ne.sh---log Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled, cuDNN 5005) Traceback (most recent call last): File "text_comprehension/as_reader.py", line 166, in exp.execute() File "/home/rzai/prj/asreader/asreader/text_comprehension/text_comprehension_base.py", line 386, in execute **self.args.evaluate_every_n) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 79, in init self._evaluator = MemoryDatasetEvaluator([context_attention, context,y_hat,y,candidates, candidates_mask, context_mask,x_mask,x], updates) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 233, in init self.theano_buffer = AggregationBuffer(theano_variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 127, in init _validate_variable_names(variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 23, in _validate_variable_names raise ValueError('Variables must have names: {}'.format(none_names)) ValueError: Variables must have names: [Elemwise{second,no_inplace}.0] Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled, cuDNN 5005)

Traceback (most recent call last): File "text_comprehension/as_reader.py", line 166, in exp.execute() File "/home/rzai/prj/asreader/asreader/text_comprehension/text_comprehension_base.py", line 386, in execute **self.args.evaluate_every_n) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 79, in init self._evaluator = MemoryDatasetEvaluator([context_attention, context,y_hat,y,candidates, candidates_mask, context_mask,x_mask,x], updates) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 233, in init self.theano_buffer = AggregationBuffer(theano_variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 127, in init _validate_variable_names(variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 23, in _validate_variable_names raise ValueError('Variables must have names: {}'.format(none_names)) ValueError: Variables must have names: [Elemwise{second,no_inplace}.0] Traceback (most recent call last): File "text_comprehension/eval/copyBestPredictions.py", line 124, in print bestValModel['params'] KeyError: 'params' /home/rzai/.local/lib/python2.7/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice. warnings.warn("Mean of empty slice.", RuntimeWarning) /home/rzai/.local/lib/python2.7/site-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount) Traceback (most recent call last): File "text_comprehension/eval/fusion.py", line 394, in result = fuse_predictions(prediction_files) File "text_comprehension/eval/fusion.py", line 158, in fuse_predictions ensemble_accuracy = accuracy(numpy.mean(all_preds, 0)) File "text_comprehension/eval/fusion.py", line 57, in accuracy for row in probas: TypeError: 'numpy.float64' object is not iterable rzai@rzai00:~/prj/asreader/asreader$

rkadlec commented 7 years ago

This is probably duplicate of #1. Just downgrade Blocks.

SeekPoint commented 7 years ago

No, I had done this '' To downgrade Blocks run: pip install git+https://github.com/mila-udem/blocks.git@359afad119f8c6ac0ebc3cc6ec6e6475656babae ''

but still see this exact error

rkadlec commented 7 years ago

Interesting, unfortunately I see this error for the first time. You get this error with newly cloned repo without any modifications?

SeekPoint commented 7 years ago

pretty sure, and I do it again from scratch:

rzai@rzai00:~/prj/asreader/asreader$ bash quick-start-cbt-ne.sh Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled) Traceback (most recent call last): File "text_comprehension/as_reader.py", line 166, in Output will be stored in test_output_cbt Computing new vocabulary for file ../data/CBTest/data/cbtest_NE_train.txt. Processed line 100000 Processed line 200000 Processed line 300000 Processed line 400000 Processed line 500000 Processed line 600000 Processed line 700000 Processed line 800000 Processed line 900000 Processed line 1000000 Processed line 1100000 Processed line 1200000 Processed line 1300000 Processed line 1400000 Processed line 1500000 Processed line 1600000 Processed line 1700000 Processed line 1800000 Processed line 1900000 Processed line 2000000 Processed line 2100000 Processed line 2200000 Processed line 2300000 STATISTICS Total words: 53825761 Total distinct words: 60278 STATISTICS Total words: 942535 Total distinct words: 10720 Added 920 new words from file ../data/CBTest/data/cbtest_NE_valid_2000ex.txt to previous vocabulary. STATISTICS Total words: 1213447 Total distinct words: 13277 Added 1311 new words from file ../data/CBTest/data/cbtest_NE_test_2500ex.txt to previous vocabulary. exp.execute() File "/home/rzai/prj/asreader/asreader/text_comprehension/text_comprehension_base.py", line 386, in execute _self.args.evaluate_every_n) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 79, in init self._evaluator = MemoryDatasetEvaluator([context_attention, context,y_hat,y,candidates, candidates_mask, context_mask,x_mask,x], updates) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 233, in init self.theano_buffer = AggregationBuffer(theano_variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 127, in init _validate_variable_names(variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 23, in _validate_variable_names raise ValueError('Variables must have names: {}'.format(none_names)) ValueError: Variables must have names: [Elemwise{second,no_inplace}.0] Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled) Traceback (most recent call last): File "text_comprehension/as_reader.py", line 166, in Output will be stored in test_output_cbt Computing new vocabulary for file ../data/CBTest/data/cbtest_NE_train.txt. Processed line 100000 Processed line 200000 Processed line 300000 Processed line 400000 Processed line 500000 Processed line 600000 Processed line 700000 Processed line 800000 Processed line 900000 Processed line 1000000 Processed line 1100000 Processed line 1200000 Processed line 1300000 Processed line 1400000 Processed line 1500000 Processed line 1600000 Processed line 1700000 Processed line 1800000 Processed line 1900000 Processed line 2000000 Processed line 2100000 Processed line 2200000 Processed line 2300000 STATISTICS Total words: 53825761 Total distinct words: 60278 STATISTICS Total words: 942535 Total distinct words: 10720 Added 920 new words from file ../data/CBTest/data/cbtest_NE_valid_2000ex.txt to previous vocabulary. STATISTICS Total words: 1213447 Total distinct words: 13277 Added 1311 new words from file ../data/CBTest/data/cbtest_NE_test_2500ex.txt to previous vocabulary. exp.execute() File "/home/rzai/prj/asreader/asreader/text_comprehension/text_comprehension_base.py", line 386, in execute _self.args.evaluate_every_n) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 79, in init self._evaluator = MemoryDatasetEvaluator([context_attention, context,y_hat,y,candidates, candidates_mask, context_mask,x_mask,x], updates) File "/home/rzai/prj/asreader/asreader/text_comprehension/monitoring.py", line 233, in init self.theano_buffer = AggregationBuffer(theano_variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 127, in init _validate_variable_names(variables) File "/usr/local/lib/python2.7/dist-packages/blocks/monitoring/evaluators.py", line 23, in _validate_variable_names raise ValueError('Variables must have names: {}'.format(none_names)) ValueError: Variables must have names: [Elemwise{second,no_inplace}.0] Validation files:

Best predictions to be copied:

Best validation model: Traceback (most recent call last): File "text_comprehension/eval/copyBestPredictions.py", line 124, in print bestValModel['params'] KeyError: 'params'

* RUNNING THE FUSION SCRIPT *

Models to be fused:

Ensemble (equal weights): /home/rzai/.local/lib/python2.7/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice. warnings.warn("Mean of empty slice.", RuntimeWarning) /home/rzai/.local/lib/python2.7/site-packages/numpy/core/_methods.py:70: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount) Traceback (most recent call last): File "text_comprehension/eval/fusion.py", line 394, in result = fuse_predictions(prediction_files) File "text_comprehension/eval/fusion.py", line 158, in fuse_predictions ensemble_accuracy = accuracy(numpy.mean(all_preds, 0)) File "text_comprehension/eval/fusion.py", line 57, in accuracy for row in probas: TypeError: 'numpy.float64' object is not iterable rzai@rzai00:~/prj/asreader/asreader$

NicholasYuan commented 6 years ago

I meet the same error. After adding y.name = "answers_y" in line 152 of file as_readee.py, this problem disappears.

I guess the theano variables at a low version may lose its name after some operations.