Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory consumption in AuthorTopicModel #2122

Merged
merged 3 commits into from
Jul 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gensim/models/atmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,13 @@ def update(self, corpus=None, author2doc=None, doc2author=None, chunksize=None,
self.doc2author[d] = a_list

# Train on all documents of authors in input_corpus.
train_corpus_idx = []
for _ in author2doc.keys(): # For all authors in input corpus.
for doc_ids in self.author2doc.values(): # For all documents in total corpus.
train_corpus_idx.extend(doc_ids)
train_corpus_idx = set()
# Collect all documents of authors.
for doc_ids in self.author2doc.values():
train_corpus_idx.update(doc_ids)

# Make the list of training documents unique.
train_corpus_idx = list(set(train_corpus_idx))
train_corpus_idx = sorted(train_corpus_idx)

# train_corpus_idx is only a list of indexes, so "len" is valid.
lencorpus = len(train_corpus_idx)
Expand Down