roatienza/Deep-Learning-Experiments

rnn_words.py: unhashable type: 'list'

bpodq opened this issue · 3 comments

bpodq commented

Loaded training data...
Traceback (most recent call last):
File "rnn_words.py", line 56, in
dictionary, reverse_dictionary = build_dataset(training_data)
File "rnn_words.py", line 49, in build_dataset
count = collections.Counter(words).most_common()
File "/usr/lib64/python2.7/collections.py", line 444, in init
self.update(iterable, **kwds)
File "/usr/lib64/python2.7/collections.py", line 526, in update
self[elem] = self_get(elem, 0) + 1
TypeError: unhashable type: 'list'

I searched the web but do not solve it, anyone can help me?

I think this might be python2.7 specific. The code has been tested on python3 only.

Loaded training data...
Traceback (most recent call last):
File "D:\Machine_Learning\LSTM\Tensorflow CNN-LSTM Model\SampleTextLSTM.py", line 59, in
dictionary, reverse_dictionary = build_dataset(training_data)
File "D:\Machine_Learning\LSTM\Tensorflow CNN-LSTM Model\SampleTextLSTM.py", line 52, in build_dataset
count = collections.Counter(words).most_common()
File "C:\Users\julia\AppData\Local\Programs\Python\Python36\lib\collections_init_.py", line 537, in init
self.update(*args, **kwds)
File "C:\Users\julia\AppData\Local\Programs\Python\Python36\lib\collections_init_.py", line 624, in update
_count_elements(self, iterable)
TypeError: unhashable type: 'list'

Running python 3.6.2, same thing happening here.

I had the same Issue, I fixed it by changing line 42

content = np.reshape(content, [-1, ]) to content = np.hstack(content)