Skip to content

Instantly share code, notes, and snippets.

@elmarhaussmann
Created December 31, 2015 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elmarhaussmann/d7670cac549cafe0862c to your computer and use it in GitHub Desktop.
Save elmarhaussmann/d7670cac549cafe0862c to your computer and use it in GitHub Desktop.
word2vec.py termination condition
while not self.jobs_finished or self.jobs_left > 0:
try:
report = progress_queue.get(timeout=2) # blocks if workers too slow
except Empty:
logger.info("Jobs left: %d" % self.jobs_left)
logger.info("Job queue size: %i" % utils.qsize(job_queue))
if self.jobs_finished:
import time
logger.info("Sleeping 10 secs.")
time.sleep(10)
logger.info("Jobs left: %d" % self.jobs_left)
logger.info("Job queue size: %i" % utils.qsize(job_queue))
break
continue
if report is None:
continue
examples, trained_words, raw_words = report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment