davidberenstein1957/concise-concepts

Unable to pass in custom gensim word2vec model

Closed this issue · 3 comments

Getting this error, TypeError: argument of type 'Word2Vec' is not iterable, when I try to pass in a custom gensim model

@akshaydevml could you share some reproducible code?

I created a word2vec model from the reviews on the IMDB dataset and tried to pass the model path through the config argument

nlp.add_pipe("concise_concepts", config={"data": data, "model_path": model_path})

Below is the code I used to create the gensim model

from gensim.models.phrases import Phrases, Phraser
sent = [row.split() for row in df['review']]
phrases = Phrases(sent, min_count=30, progress_per=10000)
bigram = Phraser(phrases)
sentences = bigram[sent]

from gensim.models import Word2Vec
w2v_model = Word2Vec(min_count=20,
window=2,
vector_size=200,
sample=6e-5,
alpha=0.03,
min_alpha=0.0007,
negative=20,
)
w2v_model.build_vocab(sentences, progress_per=10000)
w2v_model.train(sentences, total_examples=w2v_model.corpus_count, epochs=2, report_delay=1)