Commit 66eb1018 authored by Neal Wu's avatar Neal Wu
Browse files

Make textsum compatible with Python 3

parent 40a5739a
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
"""Batch reader to seq2seq attention model, with bucketing support.""" """Batch reader to seq2seq attention model, with bucketing support."""
from collections import namedtuple from collections import namedtuple
import Queue
from random import shuffle from random import shuffle
from threading import Thread from threading import Thread
import time import time
import numpy as np import numpy as np
from six.moves.queue import Queue
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
import data import data
......
...@@ -21,10 +21,11 @@ K*K results, and start over again until certain number of results are fully ...@@ -21,10 +21,11 @@ K*K results, and start over again until certain number of results are fully
decoded. decoded.
""" """
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
FLAGS = tf.flags.FLAGS FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_bool('normalize_by_length', True, 'Whether normalize') tf.flags.DEFINE_bool('normalize_by_length', True, 'Whether to normalize')
class Hypothesis(object): class Hypothesis(object):
......
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
import os import os
import time import time
import tensorflow as tf
import beam_search import beam_search
import data import data
from six.moves import xrange
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_integer('max_decode_steps', 1000000, tf.app.flags.DEFINE_integer('max_decode_steps', 1000000,
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
from collections import namedtuple from collections import namedtuple
import numpy as np import numpy as np
import tensorflow as tf
import seq2seq_lib import seq2seq_lib
from six.moves import xrange
import tensorflow as tf
HParams = namedtuple('HParams', HParams = namedtuple('HParams',
'mode, min_lr, lr, batch_size, ' 'mode, min_lr, lr, batch_size, '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment