diff --git a/run_multi-task_rnn.py b/run_multi-task_rnn.py index af8742a..e545f7a 100644 --- a/run_multi-task_rnn.py +++ b/run_multi-task_rnn.py @@ -226,7 +226,7 @@ def create_model(session, def train(): print ('Applying Parameters:') - for k,v in FLAGS.__dict__['__flags'].iteritems(): + for k,v in FLAGS.__flags.iteritems(): print ('%s: %s' % (k, str(v))) print("Preparing data in %s" % FLAGS.data_dir) vocab_path = '' diff --git a/seq_classification.py b/seq_classification.py index 7b319b6..57f706f 100644 --- a/seq_classification.py +++ b/seq_classification.py @@ -12,9 +12,13 @@ from six.moves import xrange # pylint: disable=redefined-builtin # We disable pylint because we need python3 compatibility. import tensorflow as tf -from tensorflow.python.ops import rnn_cell_impl -linear = rnn_cell_impl._linear +try: + from tensorflow.python.ops import rnn_cell_impl + linear = rnn_cell_impl._linear +except AttributeError: + from tensorflow.contrib.rnn.python.ops.core_rnn_cell import _linear + linear = _linear def attention_single_output_decoder(initial_state, attention_states, @@ -131,4 +135,4 @@ def generate_single_output(encoder_state, attention_states, sequence_length, batch_size = tf.shape(targets[0])[0] loss = tf.reduce_sum(crossent) / tf.cast(batch_size, tf.float32) - return bucket_outputs, loss \ No newline at end of file + return bucket_outputs, loss diff --git a/seq_labeling.py b/seq_labeling.py index 0066315..3ee6588 100644 --- a/seq_labeling.py +++ b/seq_labeling.py @@ -19,9 +19,12 @@ from tensorflow.contrib.legacy_seq2seq import sequence_loss_by_example from tensorflow.contrib.legacy_seq2seq import sequence_loss -from tensorflow.python.ops import rnn_cell_impl - -linear = rnn_cell_impl._linear +try: + from tensorflow.python.ops import rnn_cell_impl + linear = rnn_cell_impl._linear +except AttributeError: + from tensorflow.contrib.rnn.python.ops.core_rnn_cell import _linear + linear = _linear def _step(time, sequence_length, min_sequence_length, max_sequence_length, zero_logit, generate_logit):