ruidan / Unsupervised-Aspect-Extraction

Code for acl2017 paper "An unsupervised neural attention model for aspect extraction"
Apache License 2.0
338 stars 117 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128) #17

Open agarnitin86 opened 5 years ago

agarnitin86 commented 5 years ago

I am using gensim 0.12.4 on python 3 and still getting the following error

Traceback (most recent call last):

File "", line 1, in model = create_model(ortho_reg, neg_size, emb_dim, aspect_size, emb_path, overall_maxlen, vocab)

File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/model.py", line 63, in create_model emb_reader = EmbReader(emb_path, emb_dim=emb_dim)

File "/home/fractaluser/Projects/workspace/UnsupervisedAspectExtraction/code/w2v_emb_reader.py", line 23, in init model = gensim.models.Word2Vec.load(emb_path)

File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/gensim/models/word2vec.py", line 1485, in load model = super(Word2Vec, cls).load(*args, **kwargs)

File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/gensim/utils.py", line 248, in load obj = unpickle(fname)

File "/home/fractaluser/anaconda3/envs/venv_keras/lib/python3.5/site-packages/gensim/utils.py", line 912, in unpickle return _pickle.loads(f.read())

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128)

pati-dev commented 5 years ago

I'm getting the same error. Is there any fix available for this?

Edit: Found the solution. This issue is because of using Python3 instead of Python2.7. As recommended by the author, use Python2.7 to run the code.