Skip to content

Commit

Permalink
Rolled back some purely aesthetic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrey-fr committed Jun 22, 2021
1 parent f0af84e commit 49cf50e
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions gensim/models/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,14 +917,12 @@ def _do_train_epoch(
if self.sg:
examples, tally, raw_tally = train_epoch_sg(
self, corpus_file, offset, cython_vocab, cur_epoch,
total_examples, total_words, work, neu1,
self.compute_loss,
total_examples, total_words, work, neu1, self.compute_loss
)
else:
examples, tally, raw_tally = train_epoch_cbow(
self, corpus_file, offset, cython_vocab, cur_epoch,
total_examples, total_words, work, neu1,
self.compute_loss,
total_examples, total_words, work, neu1, self.compute_loss
)

return examples, tally, raw_tally
Expand All @@ -950,26 +948,20 @@ def _do_train_job(self, sentences, alpha, inits):
work, neu1 = inits
tally = 0
if self.sg:
tally += train_batch_sg(
self, sentences, alpha, work,
self.compute_loss,
)
tally += train_batch_sg(self, sentences, alpha, work, self.compute_loss)
else:
tally += train_batch_cbow(
self, sentences, alpha, work, neu1,
self.compute_loss,
)
tally += train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss)
return tally, self._raw_word_count(sentences)

def _clear_post_train(self):
"""Clear any cached values that training may have invalidated."""
self.wv.norms = None

def train(
self, corpus_iterable=None, corpus_file=None, total_examples=None,
total_words=None, epochs=None, start_alpha=None, end_alpha=None,
word_count=0, queue_factor=2, report_delay=1.0, compute_loss=False,
callbacks=(), **kwargs,
self, corpus_iterable=None, corpus_file=None, total_examples=None, total_words=None,
epochs=None, start_alpha=None, end_alpha=None, word_count=0,
queue_factor=2, report_delay=1.0, compute_loss=False, callbacks=(),
**kwargs,
):
"""Update the model's neural weights from a sequence of sentences.
Expand Down

0 comments on commit 49cf50e

Please sign in to comment.