C1W3 Assignment Section 1.1 provided optional code error

I copy-pasted the provided code in Course 1 Assignment 3, section 1.1 " To Run This Code On Your Own Machine" part into my local IDE. I also downloaded and unzipped the said ‘GoogleNews-vectors-negative300.bin’ file.

However, even just running the following 2-liner produced a ValueError: ‘could not broadcast input array from shape (180) into shape (300)’.

Is there any work around? I would expect provided code to work without this kind of issue, just want to know if I’ve missed something. Thanks.

Copy-paste the code below and run it on your local machine after downloading the dataset to the same directory as the notebook.

import nltk from gensim.models import KeyedVectors

embeddings = KeyedVectors.load_word2vec_format('./GoogleNews-vectors-negative300.bin', binary = True)

Hi @yhu18,

Was the same code working perfectly in the Coursera environment ?


Yes the notebook code worked perfectly. It is just this provided code (as markdown) that returns the traceback in my own notebook environment. Could it be an environment issue?