Skip to content

Instantly share code, notes, and snippets.

View elmarhaussmann's full-sized avatar

Elmar Haußmann elmarhaussmann

View GitHub Profile
@elmarhaussmann
elmarhaussmann / text_classification_character_rnn.py
Created February 23, 2018 05:12
Character based text classification with TPUEstimator
# Based on the example from the TensorFlow repository: https://github.com/tensorflow/tensorflow/
# https://github.com/tensorflow/tensorflow/blob/671baf080238025da9698ea980cd9504005f727c/tensorflow/examples/learn/text_classification_character_rnn.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
@elmarhaussmann
elmarhaussmann / word2vec.py
Created December 31, 2015 17:46
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)