From ea77539876b535107a2c6addfd89d2e68d69cb94 Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Wed, 31 Jul 2019 23:51:29 -0700 Subject: [PATCH 1/8] Update setup.py to fix numpy version issue & Modify README --- README.md | 3 +++ setup.py | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 06eb1fa4..79215060 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,9 @@ agent = tx.agents.SeqPGAgent(samples=outputs.sample_id, Many more examples are available [here](./examples) ### Installation +Texar requires tensorflow 1.7.0 or higher (lower than tensorflow 2.0.0a0) and tensorflow_probability 0.3.0 or higher. Please follow the [tensorflow official instructions](https://www.tensorflow.org/install) and [tensorflow_probability official instractions](https://www.tensorflow.org/probability/install) to install the appropriate version. + +After Tensorflow is installed, please run the following commands to install Texar: ``` git clone https://github.com/asyml/texar.git cd texar diff --git a/setup.py b/setup.py index 6b24683e..10440891 100644 --- a/setup.py +++ b/setup.py @@ -26,19 +26,19 @@ platforms='any', install_requires=[ - 'numpy', + 'numpy<1.17.0', 'pyyaml', 'requests', - 'funcsigs', + 'funcsigs>=1.0.2', ], extras_require={ 'tensorflow-cpu': [ - 'tensorflow>=1.7.0', - 'tensorflow-probability >= 0.3.0' + 'tensorflow>=1.7.0,<2.0.0', + 'tensorflow-probability>=0.3.0' ], 'tensorflow-gpu': [ 'tensorflow-gpu>=1.7.0', - 'tensorflow-probability-gpu >= 0.3.0' + 'tensorflow-probability-gpu>=0.3.0' ] }, package_data={ From 330a1ef3fbe3b83ef581e3a66c1808140a63a02b Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Fri, 2 Aug 2019 14:54:16 -0700 Subject: [PATCH 2/8] Transform style --- examples/text_style_transfer/ctrl_gen_model.py | 6 +++--- examples/transformer/transformer_main.py | 2 +- setup.py | 2 +- texar/__init__.py | 5 ++++- texar/agents/dqn_agent.py | 2 +- texar/data/data/tfrecord_data_test.py | 4 ++++ texar/data/vocabulary.py | 2 +- texar/evals/metrics.py | 6 +++--- texar/losses/mle_losses_test.py | 2 +- texar/losses/rewards.py | 2 +- texar/modules/classifiers/bert_classifiers.py | 2 +- texar/modules/classifiers/conv_classifiers.py | 2 +- texar/modules/classifiers/rnn_classifiers.py | 2 +- texar/modules/connectors/connectors.py | 2 +- texar/modules/decoders/rnn_decoder_helpers.py | 2 +- texar/modules/embedders/embedder_utils.py | 5 +++-- texar/modules/embedders/position_embedders.py | 8 +++++--- texar/modules/memory/memory_network.py | 2 +- texar/utils/beam_search.py | 17 +++++++++-------- texar/utils/mode.py | 3 ++- texar/utils/transformer_utils.py | 10 +++++----- 21 files changed, 50 insertions(+), 38 deletions(-) diff --git a/examples/text_style_transfer/ctrl_gen_model.py b/examples/text_style_transfer/ctrl_gen_model.py index 13a6e2ce..b838dc38 100644 --- a/examples/text_style_transfer/ctrl_gen_model.py +++ b/examples/text_style_transfer/ctrl_gen_model.py @@ -55,7 +55,7 @@ def _build_model(self, inputs, vocab, gamma, lambda_g): label_connector = MLPTransformConnector(self._hparams.dim_c) # Gets the sentence representation: h = (c, z) - labels = tf.to_float(tf.reshape(inputs['labels'], [-1, 1])) + labels = tf.cast(tf.reshape(inputs['labels'], [-1, 1]), tf.float32) c = label_connector(labels) c_ = label_connector(1 - labels) h = tf.concat([c, z], 1) @@ -106,7 +106,7 @@ def _build_model(self, inputs, vocab, gamma, lambda_g): inputs=clas_embedder(ids=inputs['text_ids'][:, 1:]), sequence_length=inputs['length']-1) loss_d_clas = tf.nn.sigmoid_cross_entropy_with_logits( - labels=tf.to_float(inputs['labels']), logits=clas_logits) + labels=tf.cast(inputs['labels'], tf.float32), logits=clas_logits) loss_d_clas = tf.reduce_mean(loss_d_clas) accu_d = tx.evals.accuracy(labels=inputs['labels'], preds=clas_preds) @@ -115,7 +115,7 @@ def _build_model(self, inputs, vocab, gamma, lambda_g): inputs=clas_embedder(soft_ids=soft_outputs_.sample_id), sequence_length=soft_length_) loss_g_clas = tf.nn.sigmoid_cross_entropy_with_logits( - labels=tf.to_float(1-inputs['labels']), logits=soft_logits) + labels=tf.cast(1-inputs['labels'], tf.float32), logits=soft_logits) loss_g_clas = tf.reduce_mean(loss_g_clas) # Accuracy on soft samples, for training progress monitoring diff --git a/examples/transformer/transformer_main.py b/examples/transformer/transformer_main.py index 64aa5d67..1d6bcfbc 100644 --- a/examples/transformer/transformer_main.py +++ b/examples/transformer/transformer_main.py @@ -77,7 +77,7 @@ def main(): 1 - tf.to_int32(tf.equal(encoder_input, 0)), axis=1) labels = tf.placeholder(tf.int64, shape=(None, None)) - is_target = tf.to_float(tf.not_equal(labels, 0)) + is_target = tf.cast(tf.not_equal(labels, 0), tf.float32) global_step = tf.Variable(0, dtype=tf.int64, trainable=False) learning_rate = tf.placeholder(tf.float64, shape=(), name='lr') diff --git a/setup.py b/setup.py index 10440891..440b0f8d 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ ], extras_require={ 'tensorflow-cpu': [ - 'tensorflow>=1.7.0,<2.0.0', + 'tensorflow>=1.7.0', 'tensorflow-probability>=0.3.0' ], 'tensorflow-gpu': [ diff --git a/texar/__init__.py b/texar/__init__.py index 4ed389cd..f2830848 100644 --- a/texar/__init__.py +++ b/texar/__init__.py @@ -19,9 +19,12 @@ from __future__ import division from __future__ import print_function +import tensorflow as tf + # pylint: disable=wildcard-import -import sys +if tf.__version__ >= "1.13.0": + tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) if sys.version_info.major < 3: # PY 2.x, import as is because Texar-PyTorch cannot be installed. diff --git a/texar/agents/dqn_agent.py b/texar/agents/dqn_agent.py index 3c6a9ac3..0462b8a8 100644 --- a/texar/agents/dqn_agent.py +++ b/texar/agents/dqn_agent.py @@ -292,7 +292,7 @@ def _get_target_outputs(self, state_inputs): return self._target(inputs=state_inputs, **self._qnet_caller_kwargs) def _get_td_error(self, qnet_qvalues, actions, y): - return y - tf.reduce_sum(qnet_qvalues * tf.to_float(actions), axis=1) + return y - tf.reduce_sum(qnet_qvalues * tf.cast(actions, tf.float), axis=1) def _get_train_op(self): train_op = opt.get_train_op( diff --git a/texar/data/data/tfrecord_data_test.py b/texar/data/data/tfrecord_data_test.py index 18dd6ecc..2809a58e 100644 --- a/texar/data/data/tfrecord_data_test.py +++ b/texar/data/data/tfrecord_data_test.py @@ -14,10 +14,14 @@ import copy import shutil import tempfile +import ssl import tensorflow as tf import texar as tx +ssl._create_default_https_context = ssl._create_unverified_context + + class TFRecordDataTest(tf.test.TestCase): """Tests tfrecord data class. """ diff --git a/texar/data/vocabulary.py b/texar/data/vocabulary.py index 08925b13..727d84db 100644 --- a/texar/data/vocabulary.py +++ b/texar/data/vocabulary.py @@ -182,7 +182,7 @@ def map_ids_to_tokens(self, ids): Returns: A tensor of text tokens of the same shape. """ - return self.id_to_token_map.lookup(tf.to_int64(ids)) + return self.id_to_token_map.lookup(tf.cast(ids, tf.int64)) def map_tokens_to_ids(self, tokens): """Maps text tokens into ids. diff --git a/texar/evals/metrics.py b/texar/evals/metrics.py index 7184239f..c4d10a41 100644 --- a/texar/evals/metrics.py +++ b/texar/evals/metrics.py @@ -26,7 +26,7 @@ def accuracy(labels, preds): A float scalar Tensor containing the accuracy. """ labels = tf.cast(labels, preds.dtype) - return tf.reduce_mean(tf.to_float(tf.equal(preds, labels))) + return tf.reduce_mean(tf.cast(tf.equal(preds, labels), tf.float32)) def binary_clas_accuracy(pos_preds=None, neg_preds=None): """Calculates the accuracy of binary predictions. @@ -44,7 +44,7 @@ def binary_clas_accuracy(pos_preds=None, neg_preds=None): """ pos_accu = accuracy(tf.ones_like(pos_preds), pos_preds) neg_accu = accuracy(tf.zeros_like(neg_preds), neg_preds) - psize = tf.to_float(tf.size(pos_preds)) - nsize = tf.to_float(tf.size(neg_preds)) + psize = tf.cast(tf.size(pos_preds), tf.float32) + nsize = tf.cast(tf.size(neg_preds), tf.float32) accu = (pos_accu * psize + neg_accu * nsize) / (psize + nsize) return accu diff --git a/texar/losses/mle_losses_test.py b/texar/losses/mle_losses_test.py index bf3f6820..98099647 100644 --- a/texar/losses/mle_losses_test.py +++ b/texar/losses/mle_losses_test.py @@ -102,7 +102,7 @@ def test_sequence_sigmoid_cross_entropy(self): labels = tf.placeholder(dtype=tf.int32, shape=None) loss = tx.losses.sequence_sigmoid_cross_entropy( logits=self._logits[:, :, 0], - labels=tf.to_float(labels), + labels=tf.cast(labels, tf.float32), sequence_length=self._sequence_length) with self.test_session() as sess: rank = sess.run( diff --git a/texar/losses/rewards.py b/texar/losses/rewards.py index ec52b2b7..a5ea1646 100644 --- a/texar/losses/rewards.py +++ b/texar/losses/rewards.py @@ -163,7 +163,7 @@ def _discount_reward_tensor_1d(reward, sequence_length, mask = tf.concat([mask[:, 1:], tf.zeros_like(mask[:, -1:])], axis=1) # Make each row = [discount, ..., discount, 1, ..., 1] dmat = mask * discount + (1 - mask) - dmat = tf.cumprod(dmat, axis=1, reverse=True) + dmat = tf.math.cumprod(dmat, axis=1, reverse=True) disc_reward = dmat * tf.expand_dims(reward, -1) disc_reward = mask_sequences( diff --git a/texar/modules/classifiers/bert_classifiers.py b/texar/modules/classifiers/bert_classifiers.py index 5a7d8b9c..9da4e42b 100644 --- a/texar/modules/classifiers/bert_classifiers.py +++ b/texar/modules/classifiers/bert_classifiers.py @@ -273,7 +273,7 @@ def _build(self, else: pred = tf.argmax(logits, axis=-1) pred = tf.reshape(pred, [-1]) - pred = tf.to_int64(pred) + pred = tf.cast(pred, tf.int64) if not self._built: self._add_internal_trainable_variables() diff --git a/texar/modules/classifiers/conv_classifiers.py b/texar/modules/classifiers/conv_classifiers.py index 8e73f2e7..e871a4be 100644 --- a/texar/modules/classifiers/conv_classifiers.py +++ b/texar/modules/classifiers/conv_classifiers.py @@ -189,7 +189,7 @@ def _build(self, # pylint: disable=arguments-differ logits = tf.reshape(logits, [-1]) else: pred = tf.argmax(logits, 1) - pred = tf.to_int64(tf.reshape(pred, [-1])) + pred = tf.cast(tf.reshape(pred, [-1]), tf.int64) self._built = True diff --git a/texar/modules/classifiers/rnn_classifiers.py b/texar/modules/classifiers/rnn_classifiers.py index 77ee4774..25b54060 100644 --- a/texar/modules/classifiers/rnn_classifiers.py +++ b/texar/modules/classifiers/rnn_classifiers.py @@ -328,7 +328,7 @@ def _build(self, else: pred = tf.argmax(logits, axis=-1) pred = tf.reshape(pred, [-1]) - pred = tf.to_int64(pred) + pred = tf.cast(pred, tf.int64) if not self._built: self._add_internal_trainable_variables() diff --git a/texar/modules/connectors/connectors.py b/texar/modules/connectors/connectors.py index 287338f0..48564657 100644 --- a/texar/modules/connectors/connectors.py +++ b/texar/modules/connectors/connectors.py @@ -664,7 +664,7 @@ class instance. dstr = check_or_get_instance( distribution, distribution_kwargs, ["tensorflow.distributions", "tensorflow_probability.distributions", - "tensorflow.contrib.distributions", "texar.custom"]) + "texar.custom"]) if num_samples: sample = dstr.sample(num_samples) diff --git a/texar/modules/decoders/rnn_decoder_helpers.py b/texar/modules/decoders/rnn_decoder_helpers.py index d1f76e8e..a1e3ca09 100644 --- a/texar/modules/decoders/rnn_decoder_helpers.py +++ b/texar/modules/decoders/rnn_decoder_helpers.py @@ -22,7 +22,7 @@ import tensorflow as tf from tensorflow.python.ops import array_ops from tensorflow.python.ops.distributions import categorical -from tensorflow.contrib.distributions import RelaxedOneHotCategorical \ +from tensorflow_probability.distributions import RelaxedOneHotCategorical \ as GumbelSoftmax from texar.modules.decoders.tf_helpers import \ diff --git a/texar/modules/embedders/embedder_utils.py b/texar/modules/embedders/embedder_utils.py index 392d23a7..cdfcc750 100644 --- a/texar/modules/embedders/embedder_utils.py +++ b/texar/modules/embedders/embedder_utils.py @@ -208,8 +208,9 @@ def get_embedding(hparams=None, regularizer=regularizer, trainable=hparams["trainable"]) else: + init_value = tf.cast(init_value, tf.float32) embedding = tf.get_variable(name='w', - initializer=tf.to_float(init_value), + initializer=init_value, regularizer=regularizer, trainable=hparams["trainable"]) @@ -239,4 +240,4 @@ def soft_embedding_lookup(embedding, soft_ids): soft_seq_emb = soft_embedding_lookup( embedding, tf.nn.softmax(decoder_outputs.logits)) """ - return tf.tensordot(tf.to_float(soft_ids), embedding, [-1, 0]) + return tf.tensordot(tf.cast(soft_ids, tf.float32), embedding, [-1, 0]) diff --git a/texar/modules/embedders/position_embedders.py b/texar/modules/embedders/position_embedders.py index f623c4ea..bf577833 100644 --- a/texar/modules/embedders/position_embedders.py +++ b/texar/modules/embedders/position_embedders.py @@ -279,9 +279,10 @@ def __init__(self, position_size, hparams=None): log_timescale_increment = math.log( float(max_timescale) / float(min_timescale) - ) / (tf.to_float(num_timescales) - 1) + ) / (tf.cast(num_timescales, tf.float32) - 1) + num_range = tf.range(num_timescales, dtype=tf.float32) inv_timescales = min_timescale * tf.exp( - tf.to_float(tf.range(num_timescales)) * -log_timescale_increment + num_range * -log_timescale_increment ) self.inv_timescales = inv_timescales @@ -291,7 +292,8 @@ def __init__(self, position_size, hparams=None): "'position_size' must not be None when " "'cache_embeddings' is set to True" ) - positions = tf.to_float(tf.range(position_size, dtype=tf.int32)) + + positions = tf.range(position_size, dtype=tf.float32) signal = self._compute_embeddings(positions) self.signal = signal diff --git a/texar/modules/memory/memory_network.py b/texar/modules/memory/memory_network.py index ef70fcb6..18ad1655 100644 --- a/texar/modules/memory/memory_network.py +++ b/texar/modules/memory/memory_network.py @@ -587,7 +587,7 @@ def _unsqueeze(x): random_tensor = keep_prob + noise binary_tensor = tf.floor(random_tensor) def _variational_dropout(val): - return tf.div(val, keep_prob) * binary_tensor + return tf.math.div(val, keep_prob) * binary_tensor for _ in range(self._n_hops): u_ = self._AC(self._u[-1], self._m, self._c) diff --git a/texar/utils/beam_search.py b/texar/utils/beam_search.py index 58d341e3..872a1069 100644 --- a/texar/utils/beam_search.py +++ b/texar/utils/beam_search.py @@ -306,7 +306,7 @@ def grow_finished(finished_seq, finished_scores, finished_flags, # Set the scores of the unfinished seq in curr_seq to large # negative values - curr_scores += (1. - tf.to_float(curr_finished)) * -INF + curr_scores += (1. - tf.cast(curr_finished), tf.float32) * -INF # concatenating the sequences and scores along beam axis curr_finished_seq = tf.concat([finished_seq, curr_seq], axis=1) curr_finished_scores = tf.concat([finished_scores, curr_scores], @@ -343,7 +343,7 @@ def grow_alive(curr_seq, curr_scores, curr_log_probs, curr_finished, """ # Set the scores of the finished seq in curr_seq to large negative # values - curr_scores += tf.to_float(curr_finished) * -INF + curr_scores += tf.cast(curr_finished, tf.float32) * -INF return compute_topk_scores_and_seq(curr_seq, curr_scores, curr_log_probs, curr_finished, beam_size, batch_size, "grow_alive", states) @@ -400,8 +400,8 @@ def grow_topk(i, alive_seq, alive_log_probs, states): # (batch_size, beam_size, vocab_size) + (batch_size, beam_size, 1) log_probs = candidate_log_probs + tf.expand_dims(alive_log_probs, axis=2) - - length_penalty = tf.pow(((5. + tf.to_float(i + 1)) / 6.), alpha) + i_p = tf.cast(i + 1, tf.float32) + length_penalty = tf.pow(((5. + i_p) / 6.), alpha) curr_scores = log_probs / length_penalty # Flatten out (beam_size, vocab_size) probs in to a list of @@ -534,7 +534,8 @@ def _is_finished(i, unused_alive_seq, alive_log_probs, """ if not stop_early: return tf.less(i, decode_length) - max_length_penalty = tf.pow(((5. + tf.to_float(decode_length)) \ + max_length_penalty = tf.pow( + ((5. + tf.cast(decode_length, tf.float32)) \ / 6.), alpha) # The best possible score of the most likley alive sequence lower_bound_alive_scores = alive_log_probs[:, 0] /\ @@ -546,15 +547,15 @@ def _is_finished(i, unused_alive_seq, alive_log_probs, # since scores are all -ve, taking the min will give us the score # of the lowest finished item. lowest_score_of_fininshed_in_finished = tf.reduce_min( - finished_scores * tf.to_float(finished_in_finished), + finished_scores * tf.cast(finished_in_finished, tf.float32), axis=1) # If none of the sequences have finished, then the min will be 0 # and we have to replace it by -ve INF if it is. The score of any # seq in alive will be much higher than -ve INF and the # termination condition will not be met. lowest_score_of_fininshed_in_finished += ( - (1. - tf.to_float(tf.reduce_any(finished_in_finished, - 1))) * -INF) + (1. - tf.cast(tf.reduce_any(finished_in_finished, + 1), tf.float32)) * -INF) bound_is_met = tf.reduce_all( tf.greater(lowest_score_of_fininshed_in_finished, diff --git a/texar/utils/mode.py b/texar/utils/mode.py index 5ee59c9a..dce338aa 100644 --- a/texar/utils/mode.py +++ b/texar/utils/mode.py @@ -145,4 +145,5 @@ def switch_dropout(dropout_keep_prob, mode=None): A unit Tensor that equals the dropout keep probability in `TRAIN` mode, and `1.0` in other modes. """ - return 1. - (1. - dropout_keep_prob) * tf.to_float(is_train_mode(mode)) + return 1. - (1. - dropout_keep_prob) \ + * tf.cast(is_train_mode(mode), tf.float32) diff --git a/texar/utils/transformer_utils.py b/texar/utils/transformer_utils.py index 899bab70..9d5b36cc 100644 --- a/texar/utils/transformer_utils.py +++ b/texar/utils/transformer_utils.py @@ -124,7 +124,7 @@ def embedding_to_padding(emb): a float Tensor with shape [...]. """ emb_sum = tf.reduce_sum(tf.abs(emb), axis=-1) - return tf.to_float(tf.equal(emb_sum, 0.0)) + return tf.cast(tf.equal(emb_sum, 0.0), tf.float32) def smoothing_cross_entropy(logits, labels, @@ -153,11 +153,11 @@ def smoothing_cross_entropy(logits, with tf.name_scope("smoothing_cross_entropy", values=[logits, labels]): # Low confidence is given to all non-true labels, uniformly. if zero_pad: - low_confidence = (1.0 - confidence) / tf.to_float( - vocab_size - 2) + low_confidence = (1.0 - confidence) / tf.cast( + vocab_size - 2, tf.float32) else: - low_confidence = (1.0 - confidence) / tf.to_float( - vocab_size - 1) + low_confidence = (1.0 - confidence) / tf.cast( + vocab_size - 1, f.float32) if gaussian and confidence > 0.0: labels = tf.cast(labels, tf.float32) From 653cefb9911b93b607b6fdd327592dde519f3834 Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Sun, 4 Aug 2019 14:42:51 -0700 Subject: [PATCH 3/8] Toggle off tf warnings & Add custom & Polish code style --- examples/bert/bert_classifier_main.py | 2 +- examples/bert/bert_classifier_main_v2.py | 2 +- .../seq2seq_exposure_bias/interpolation_helper.py | 7 ++++--- examples/transformer/transformer_main.py | 2 +- setup.py | 4 ++-- texar/__init__.py | 13 +++++++++++-- texar/core/layers.py | 2 +- texar/core/optimization.py | 7 ++++--- texar/custom/__init__.py | 0 texar/data/data_decoders.py | 2 +- texar/losses/rewards.py | 2 +- texar/modules/decoders/rnn_decoder_helpers.py | 8 ++++---- texar/modules/decoders/tf_helpers.py | 11 +++++------ texar/modules/decoders/transformer_decoders.py | 2 +- texar/modules/policies/policy_nets.py | 3 ++- texar/modules/policies/policy_nets_test.py | 3 ++- texar/utils/beam_search.py | 2 +- texar/utils/transformer_utils.py | 6 +++--- 18 files changed, 45 insertions(+), 33 deletions(-) create mode 100644 texar/custom/__init__.py diff --git a/examples/bert/bert_classifier_main.py b/examples/bert/bert_classifier_main.py index 973c69bb..dbcf98f0 100644 --- a/examples/bert/bert_classifier_main.py +++ b/examples/bert/bert_classifier_main.py @@ -107,7 +107,7 @@ def main(_): input_ids = batch["input_ids"] segment_ids = batch["segment_ids"] batch_size = tf.shape(input_ids)[0] - input_length = tf.reduce_sum(1 - tf.to_int32(tf.equal(input_ids, 0)), + input_length = tf.reduce_sum(1 - tf.cast(tf.equal(input_ids, 0), tf.int32), axis=1) # Builds BERT with tf.variable_scope('bert'): diff --git a/examples/bert/bert_classifier_main_v2.py b/examples/bert/bert_classifier_main_v2.py index d51929fe..0d23f840 100644 --- a/examples/bert/bert_classifier_main_v2.py +++ b/examples/bert/bert_classifier_main_v2.py @@ -85,7 +85,7 @@ def main(_): input_ids = batch["input_ids"] segment_ids = batch["segment_ids"] batch_size = tf.shape(input_ids)[0] - input_length = tf.reduce_sum(1 - tf.to_int32(tf.equal(input_ids, 0)), + input_length = tf.reduce_sum(1 - tf.cast(tf.equal(input_ids, 0), tf.int32), axis=1) # Builds BERT hparams = { diff --git a/examples/seq2seq_exposure_bias/interpolation_helper.py b/examples/seq2seq_exposure_bias/interpolation_helper.py index a0a22825..099c995a 100644 --- a/examples/seq2seq_exposure_bias/interpolation_helper.py +++ b/examples/seq2seq_exposure_bias/interpolation_helper.py @@ -22,6 +22,7 @@ import tensorflow as tf import numpy as np +from tensorflow_probability import distributions as tfpd from tensorflow.contrib.seq2seq import SampleEmbeddingHelper from texar.evals.bleu import sentence_bleu from rouge import Rouge @@ -95,12 +96,12 @@ def sample(self, time, outputs, state, name=None): of 'state'([decoded_ids, rnn_state]) """ sample_method_sampler = \ - tf.distributions.Categorical(probs=self._lambdas) + tfpd.Categorical(probs=self._lambdas) sample_method_id = sample_method_sampler.sample() truth_feeding = lambda: tf.cond( tf.less(time, tf.shape(self._ground_truth)[1]), - lambda: tf.to_int32(self._ground_truth[:, time]), + lambda: tf.cast(self._ground_truth[:, time], tf.int32), lambda: tf.ones_like(self._ground_truth[:, 0], dtype=tf.int32) * self._vocab.eos_token_id) @@ -207,7 +208,7 @@ def _get_rewards(time, prefix_ids, target_ids, ground_truth_length): return result - sampler = tf.distributions.Categorical( + sampler = tfpd.Categorical( logits=tf.py_func(_get_rewards, [ time, state[0], self._ground_truth, self._ground_truth_length], tf.float32)) diff --git a/examples/transformer/transformer_main.py b/examples/transformer/transformer_main.py index 1d6bcfbc..2d402b0b 100644 --- a/examples/transformer/transformer_main.py +++ b/examples/transformer/transformer_main.py @@ -74,7 +74,7 @@ def main(): batch_size = tf.shape(encoder_input)[0] # (text sequence length excluding padding) encoder_input_length = tf.reduce_sum( - 1 - tf.to_int32(tf.equal(encoder_input, 0)), axis=1) + 1 - tf.cast(tf.equal(encoder_input, 0), tf.int32), axis=1) labels = tf.placeholder(tf.int64, shape=(None, None)) is_target = tf.cast(tf.not_equal(labels, 0), tf.float32) diff --git a/setup.py b/setup.py index 440b0f8d..7ab27531 100644 --- a/setup.py +++ b/setup.py @@ -33,11 +33,11 @@ ], extras_require={ 'tensorflow-cpu': [ - 'tensorflow>=1.7.0', + 'tensorflow>=1.10.0', 'tensorflow-probability>=0.3.0' ], 'tensorflow-gpu': [ - 'tensorflow-gpu>=1.7.0', + 'tensorflow-gpu>=1.10.0', 'tensorflow-probability-gpu>=0.3.0' ] }, diff --git a/texar/__init__.py b/texar/__init__.py index f2830848..8b5c484d 100644 --- a/texar/__init__.py +++ b/texar/__init__.py @@ -19,11 +19,20 @@ from __future__ import division from __future__ import print_function -import tensorflow as tf # pylint: disable=wildcard-import -if tf.__version__ >= "1.13.0": +import sys +from packaging import version +import tensorflow as tf + + +VERSION_WARNING = "1.13.2" + + +if version.parse(tf.__version__) <= version.parse(VERSION_WARNING): + tf.logging.set_verbosity(tf.logging.ERROR) +else: tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) if sys.version_info.major < 3: diff --git a/texar/core/layers.py b/texar/core/layers.py index c1426213..a69fee20 100644 --- a/texar/core/layers.py +++ b/texar/core/layers.py @@ -573,7 +573,7 @@ def get_layer(hparams): if not is_str(layer_type) and not isinstance(layer_type, type): layer = layer_type else: - layer_modules = ["tensorflow.layers", "texar.core", "texar.costum"] + layer_modules = ["tensorflow.layers", "texar.core", "texar.custom"] layer_class = utils.check_or_get_class(layer_type, layer_modules) if isinstance(hparams, dict): default_kwargs = _layer_class_to_default_kwargs_map.get(layer_class, diff --git a/texar/core/optimization.py b/texar/core/optimization.py index 078d7420..c7963689 100644 --- a/texar/core/optimization.py +++ b/texar/core/optimization.py @@ -259,8 +259,8 @@ def get_learning_rate_decay_fn(hparams=None): if fn_kwargs is HParams: fn_kwargs = fn_kwargs.todict() - start_step = tf.to_int32(hparams["start_decay_step"]) - end_step = tf.to_int32(hparams["end_decay_step"]) + start_step = tf.cast(hparams["start_decay_step"], tf.int32) + end_step = tf.cast(hparams["end_decay_step"], tf.int32) def lr_decay_fn(learning_rate, global_step): """Learning rate decay function. @@ -273,7 +273,8 @@ def lr_decay_fn(learning_rate, global_step): scalar float Tensor: decayed learning rate. """ offset_global_step = tf.maximum( - tf.minimum(tf.to_int32(global_step), end_step) - start_step, 0) + tf.minimum(tf.cast(global_step, tf.int32), end_step) - start_step, + 0) if decay_fn == tf.train.piecewise_constant: decayed_lr = decay_fn(x=offset_global_step, **fn_kwargs) else: diff --git a/texar/custom/__init__.py b/texar/custom/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/texar/data/data_decoders.py b/texar/data/data_decoders.py index 6ee931f6..4b2ab7b0 100644 --- a/texar/data/data_decoders.py +++ b/texar/data/data_decoders.py @@ -630,7 +630,7 @@ def decode(self, data, items): if from_type is to_type: continue elif to_type is tf.string: - decoded_data[key] = tf.dtypes.as_string(decoded_data[key]) + decoded_data[key] = tf.as_string(decoded_data[key]) elif from_type is tf.string: decoded_data[key] = tf.string_to_number( decoded_data[key], to_type) diff --git a/texar/losses/rewards.py b/texar/losses/rewards.py index a5ea1646..ec52b2b7 100644 --- a/texar/losses/rewards.py +++ b/texar/losses/rewards.py @@ -163,7 +163,7 @@ def _discount_reward_tensor_1d(reward, sequence_length, mask = tf.concat([mask[:, 1:], tf.zeros_like(mask[:, -1:])], axis=1) # Make each row = [discount, ..., discount, 1, ..., 1] dmat = mask * discount + (1 - mask) - dmat = tf.math.cumprod(dmat, axis=1, reverse=True) + dmat = tf.cumprod(dmat, axis=1, reverse=True) disc_reward = dmat * tf.expand_dims(reward, -1) disc_reward = mask_sequences( diff --git a/texar/modules/decoders/rnn_decoder_helpers.py b/texar/modules/decoders/rnn_decoder_helpers.py index a1e3ca09..e168d249 100644 --- a/texar/modules/decoders/rnn_decoder_helpers.py +++ b/texar/modules/decoders/rnn_decoder_helpers.py @@ -22,8 +22,7 @@ import tensorflow as tf from tensorflow.python.ops import array_ops from tensorflow.python.ops.distributions import categorical -from tensorflow_probability.distributions import RelaxedOneHotCategorical \ - as GumbelSoftmax +from tensorflow_probability import distributions as tfpd from texar.modules.decoders.tf_helpers import \ Helper, TrainingHelper, GreedyEmbeddingHelper @@ -271,7 +270,7 @@ def sample(self, time, outputs, state, name=None): logits = _top_k_logits(logits, k=self._top_k) - sample_id_sampler = categorical.Categorical(logits=logits) + sample_id_sampler = tfpd.Categorical(logits=logits) sample_ids = sample_id_sampler.sample(seed=self._seed) return sample_ids @@ -475,7 +474,8 @@ def sample(self, time, outputs, state, name=None): this is one-hot vectors of the greedy samples. """ sample_ids = tf.nn.softmax(outputs / self._tau) - sample_ids = GumbelSoftmax(self._tau, logits=outputs).sample() + sample_ids = tfpd.RelaxedOneHotCategorical( + self._tau, logits=outputs).sample() if self._straight_through: size = tf.shape(sample_ids)[-1] sample_ids_hard = tf.cast( diff --git a/texar/modules/decoders/tf_helpers.py b/texar/modules/decoders/tf_helpers.py index 4416559c..423fc3b7 100644 --- a/texar/modules/decoders/tf_helpers.py +++ b/texar/modules/decoders/tf_helpers.py @@ -40,8 +40,7 @@ from tensorflow.python.ops import gen_array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import tensor_array_ops -from tensorflow.python.ops.distributions import bernoulli -from tensorflow.python.ops.distributions import categorical +from tensorflow_probability import distributions as tfpd from tensorflow.python.util import nest from texar.utils.shapes import shape_list @@ -340,11 +339,11 @@ def sample(self, time, outputs, state, name=None): with ops.name_scope(name, "ScheduledEmbeddingTrainingHelperSample", [time, outputs, state]): # Return -1s where we did not sample, and sample_ids elsewhere - select_sampler = bernoulli.Bernoulli( + select_sampler = tfpd.Bernoulli( probs=self._sampling_probability, dtype=dtypes.bool) select_sample = select_sampler.sample( sample_shape=self.batch_size, seed=self._scheduling_seed) - sample_id_sampler = categorical.Categorical(logits=outputs) + sample_id_sampler = tfpd.Categorical(logits=outputs) return array_ops.where( select_sample, sample_id_sampler.sample(seed=self._seed), @@ -468,7 +467,7 @@ def sample(self, time, outputs, state, name=None): """Gets a sample for one step.""" with ops.name_scope(name, "ScheduledOutputTrainingHelperSample", [time, outputs, state]): - sampler = bernoulli.Bernoulli(probs=self._sampling_probability) + sampler = tfpd.Bernoulli(probs=self._sampling_probability) return sampler.sample(sample_shape=self.batch_size, seed=self._seed) def next_inputs(self, time, outputs, state, sample_ids, name=None): @@ -700,7 +699,7 @@ def sample(self, time, outputs, state, name=None): else: logits = outputs / self._softmax_temperature - sample_id_sampler = categorical.Categorical(logits=logits) + sample_id_sampler = tfpd.Categorical(logits=logits) sample_ids = sample_id_sampler.sample(seed=self._seed) return sample_ids diff --git a/texar/modules/decoders/transformer_decoders.py b/texar/modules/decoders/transformer_decoders.py index 4f77091e..2e88864c 100644 --- a/texar/modules/decoders/transformer_decoders.py +++ b/texar/modules/decoders/transformer_decoders.py @@ -510,7 +510,7 @@ def _build(self, # pylint: disable=arguments-differ, too-many-statements cache=None, mode=mode) logits = self._output_layer(decoder_output) - preds = tf.to_int32(tf.argmax(logits, axis=-1)) + preds = tf.cast(tf.argmax(logits, axis=-1), tf.int32) rets = TransformerDecoderOutput( logits=logits, sample_id=preds diff --git a/texar/modules/policies/policy_nets.py b/texar/modules/policies/policy_nets.py index 65bb4bbd..39235c8c 100644 --- a/texar/modules/policies/policy_nets.py +++ b/texar/modules/policies/policy_nets.py @@ -21,6 +21,7 @@ import numpy as np import tensorflow as tf +from tensorflow_probability import distributions as tfpd from texar.module_base import ModuleBase from texar.agents.agent_utils import Space @@ -303,7 +304,7 @@ def _build(self, inputs, mode=None): dkwargs = self._hparams.distribution_kwargs.todict() dkwargs['dtype'] = get_tf_dtype(dkwargs['dtype']) - dist = tf.distributions.Categorical(logits=logits, **dkwargs) + dist = tfpd.Categorical(logits=logits, **dkwargs) action = dist.sample() to_shape = [-1] # for batch dimension diff --git a/texar/modules/policies/policy_nets_test.py b/texar/modules/policies/policy_nets_test.py index 92704ef3..d6bb6873 100644 --- a/texar/modules/policies/policy_nets_test.py +++ b/texar/modules/policies/policy_nets_test.py @@ -9,6 +9,7 @@ from __future__ import unicode_literals import tensorflow as tf +from tensorflow_probability import distributions as tfpd from texar.modules.policies.policy_nets import CategoricalPolicyNet @@ -26,7 +27,7 @@ def test_categorical_policy(self): self.assertEqual(list(outputs['action'].shape[1:]), list(policy.action_space.shape)) self.assertIsInstance(outputs['dist'], - tf.distributions.Categorical) + tfpd.Categorical) inputs = tf.random_uniform(shape=[64, 4]) diff --git a/texar/utils/beam_search.py b/texar/utils/beam_search.py index 872a1069..658bca16 100644 --- a/texar/utils/beam_search.py +++ b/texar/utils/beam_search.py @@ -306,7 +306,7 @@ def grow_finished(finished_seq, finished_scores, finished_flags, # Set the scores of the unfinished seq in curr_seq to large # negative values - curr_scores += (1. - tf.cast(curr_finished), tf.float32) * -INF + curr_scores += (1. - tf.cast(curr_finished, tf.float32)) * -INF # concatenating the sequences and scores along beam axis curr_finished_seq = tf.concat([finished_seq, curr_seq], axis=1) curr_finished_scores = tf.concat([finished_scores, curr_scores], diff --git a/texar/utils/transformer_utils.py b/texar/utils/transformer_utils.py index 9d5b36cc..d62a6a41 100644 --- a/texar/utils/transformer_utils.py +++ b/texar/utils/transformer_utils.py @@ -24,6 +24,7 @@ from __future__ import unicode_literals import tensorflow as tf +from tensorflow_probability import distributions as tfpd # pylint: disable=invalid-name, too-many-arguments, too-many-locals @@ -68,7 +69,7 @@ def __init__(self, pad_mask): # float32, checking zero equality is done with |x| < epsilon, with # epsilon=1e-9 as standard, here pad_mask only contains positive # values so tf.abs would be redundant) - self.nonpad_ids = tf.to_int32(tf.where(pad_mask < 1e-9)) + self.nonpad_ids = tf.cast(tf.where(pad_mask < 1e-9), tf.int32) self.dim_origin = tf.shape(pad_mask)[:1] def remove(self, x): @@ -161,8 +162,7 @@ def smoothing_cross_entropy(logits, if gaussian and confidence > 0.0: labels = tf.cast(labels, tf.float32) - normal_dist = tf.distributions.Normal(loc=labels, - scale=confidence) + normal_dist = tfpd.Normal(loc=labels, scale=confidence) soft_targets = normal_dist.prob( tf.cast(tf.range(vocab_size), tf.float32)\ [:, None, None]) From b22780f662fdb60ad8b37cc81ade0aaa02a25f28 Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Sun, 4 Aug 2019 15:33:29 -0700 Subject: [PATCH 4/8] Fix minor typos --- examples/bert/bert_classifier_main.py | 2 +- examples/seq2seq_exposure_bias/interpolation_helper.py | 6 +++--- examples/transformer/transformer_main.py | 2 +- texar/__init__.py | 3 +-- texar/modules/__init__.py | 2 +- texar/modules/decoders/rnn_decoder_helpers.py | 1 - texar/modules/decoders/rnn_decoders.py | 1 - 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/bert/bert_classifier_main.py b/examples/bert/bert_classifier_main.py index dbcf98f0..747f1e30 100644 --- a/examples/bert/bert_classifier_main.py +++ b/examples/bert/bert_classifier_main.py @@ -198,7 +198,7 @@ def _train_epoch(sess): periodically. """ iterator.restart_dataset(sess, 'train') - + fetches = { 'train_op': train_op, 'loss': loss, diff --git a/examples/seq2seq_exposure_bias/interpolation_helper.py b/examples/seq2seq_exposure_bias/interpolation_helper.py index 099c995a..ac0211df 100644 --- a/examples/seq2seq_exposure_bias/interpolation_helper.py +++ b/examples/seq2seq_exposure_bias/interpolation_helper.py @@ -105,10 +105,10 @@ def sample(self, time, outputs, state, name=None): lambda: tf.ones_like(self._ground_truth[:, 0], dtype=tf.int32) * self._vocab.eos_token_id) - self_feeding = lambda : SampleEmbeddingHelper.sample( + self_feeding = lambda: SampleEmbeddingHelper.sample( self, time, outputs, state, name) - reward_feeding = lambda : self._sample_by_reward(time, state) + reward_feeding = lambda: self._sample_by_reward(time, state) sample_ids = tf.cond( tf.logical_or(tf.equal(time, 0), tf.equal(sample_method_id, 1)), @@ -213,4 +213,4 @@ def _get_rewards(time, prefix_ids, target_ids, ground_truth_length): time, state[0], self._ground_truth, self._ground_truth_length], tf.float32)) return tf.reshape( - sampler.sample(), (tf.shape(self._ground_truth)[0],)) \ No newline at end of file + sampler.sample(), (tf.shape(self._ground_truth)[0],)) diff --git a/examples/transformer/transformer_main.py b/examples/transformer/transformer_main.py index 2d402b0b..99597c8f 100644 --- a/examples/transformer/transformer_main.py +++ b/examples/transformer/transformer_main.py @@ -22,8 +22,8 @@ import random import os import importlib -from torchtext import data import tensorflow as tf +from torchtext import data import texar as tx from texar.modules import TransformerEncoder, TransformerDecoder from texar.utils import transformer_utils diff --git a/texar/__init__.py b/texar/__init__.py index 8b5c484d..20aa542c 100644 --- a/texar/__init__.py +++ b/texar/__init__.py @@ -27,8 +27,7 @@ import tensorflow as tf -VERSION_WARNING = "1.13.2" - +VERSION_WARNING = "1.13.2" if version.parse(tf.__version__) <= version.parse(VERSION_WARNING): tf.logging.set_verbosity(tf.logging.ERROR) diff --git a/texar/modules/__init__.py b/texar/modules/__init__.py index 12807b18..27818b71 100644 --- a/texar/modules/__init__.py +++ b/texar/modules/__init__.py @@ -30,4 +30,4 @@ from texar.modules.policies import * from texar.modules.qnets import * from texar.modules.memory import * -from texar.modules.berts import * \ No newline at end of file +from texar.modules.berts import * diff --git a/texar/modules/decoders/rnn_decoder_helpers.py b/texar/modules/decoders/rnn_decoder_helpers.py index e168d249..9e61e639 100644 --- a/texar/modules/decoders/rnn_decoder_helpers.py +++ b/texar/modules/decoders/rnn_decoder_helpers.py @@ -21,7 +21,6 @@ import tensorflow as tf from tensorflow.python.ops import array_ops -from tensorflow.python.ops.distributions import categorical from tensorflow_probability import distributions as tfpd from texar.modules.decoders.tf_helpers import \ diff --git a/texar/modules/decoders/rnn_decoders.py b/texar/modules/decoders/rnn_decoders.py index 124fd9d1..d81d2b7e 100644 --- a/texar/modules/decoders/rnn_decoders.py +++ b/texar/modules/decoders/rnn_decoders.py @@ -683,4 +683,3 @@ def wrapper_state_size(self): Equivalent to :attr:`decoder.cell.state_size`. """ return self._cell.state_size - From 9ae000ce66d4509a7d4fd61504f2a673c2127bba Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Sun, 4 Aug 2019 16:00:31 -0700 Subject: [PATCH 5/8] Fix typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79215060..42d4acbc 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ agent = tx.agents.SeqPGAgent(samples=outputs.sample_id, Many more examples are available [here](./examples) ### Installation -Texar requires tensorflow 1.7.0 or higher (lower than tensorflow 2.0.0a0) and tensorflow_probability 0.3.0 or higher. Please follow the [tensorflow official instructions](https://www.tensorflow.org/install) and [tensorflow_probability official instractions](https://www.tensorflow.org/probability/install) to install the appropriate version. +Texar requires tensorflow 1.10.0 or higher (lower than tensorflow 2.0.0a0) and tensorflow_probability 0.3.0 or higher. Please follow the [tensorflow official instructions](https://www.tensorflow.org/install) and [tensorflow_probability official instractions](https://www.tensorflow.org/probability/install) to install the appropriate version. After Tensorflow is installed, please run the following commands to install Texar: ``` From 2f763b29d4a1c08d8c707c03bec70e0f15342a82 Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Mon, 5 Aug 2019 10:05:57 -0700 Subject: [PATCH 6/8] Modify README.md & Modify setup file for versions and packages --- README.md | 6 +++++- setup.py | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 42d4acbc..74c5a51f 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,11 @@ agent = tx.agents.SeqPGAgent(samples=outputs.sample_id, Many more examples are available [here](./examples) ### Installation -Texar requires tensorflow 1.10.0 or higher (lower than tensorflow 2.0.0a0) and tensorflow_probability 0.3.0 or higher. Please follow the [tensorflow official instructions](https://www.tensorflow.org/install) and [tensorflow_probability official instractions](https://www.tensorflow.org/probability/install) to install the appropriate version. +Besides the packages in requirements.txt, Texar additionally requires: + +* tensorflow >= 1.10.0 (but <= 2.0). Follow the tensorflow official instructions to install the appropriate version + +* tensorflow_probability >= 0.3.0. Follow the tensorflow_probability official instractions to install. After Tensorflow is installed, please run the following commands to install Texar: ``` diff --git a/setup.py b/setup.py index 7ab27531..edd016d1 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setuptools.setup( name="texar", - version="0.2.1", + version="0.2.2", url="https://github.com/asyml/texar", description="Toolkit for Machine Learning and Text Generation", @@ -30,14 +30,15 @@ 'pyyaml', 'requests', 'funcsigs>=1.0.2', + 'packaging' ], extras_require={ 'tensorflow-cpu': [ - 'tensorflow>=1.10.0', + 'tensorflow>=1.10.0,<2.0', 'tensorflow-probability>=0.3.0' ], 'tensorflow-gpu': [ - 'tensorflow-gpu>=1.10.0', + 'tensorflow-gpu>=1.10.0,<2.0', 'tensorflow-probability-gpu>=0.3.0' ] }, From 64da4aa79fb75d9a22df7ec48b4ce8ecd5805a17 Mon Sep 17 00:00:00 2001 From: Zhiting Hu Date: Mon, 5 Aug 2019 14:27:52 -0400 Subject: [PATCH 7/8] Update CHANGELOG.md and version.py for v0.2.2 --- CHANGELOG.md | 10 ++++++++++ texar/version.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc2d0d76..d00d7341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ ### Feature improvements +### Fixes + +## [v0.2.2](https://github.com/asyml/texar/releases/tag/v0.2.2) (2019-08-05) + +### New features + +* Enable installation from [Pypi](https://pypi.org/project/texar/). ([#186](https://github.com/asyml/texar/pull/186)) + +### Feature improvements + * Use lazy import to be compatible with [texar-pytorch](https://github.com/asyml/texar-pytorch). ([#183](https://github.com/asyml/texar/pull/183)) ### Fixes diff --git a/texar/version.py b/texar/version.py index 84506343..e1f07011 100644 --- a/texar/version.py +++ b/texar/version.py @@ -14,7 +14,7 @@ _MAJOR = "0" _MINOR = "2" -_REVISION = "2-unreleased" +_REVISION = "2" VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR) VERSION = "{0}.{1}.{2}".format(_MAJOR, _MINOR, _REVISION) From d93ec2afd5b61d098a1ea9b10566a5de46e3355d Mon Sep 17 00:00:00 2001 From: Shibiao Nong Date: Mon, 5 Aug 2019 11:32:15 -0700 Subject: [PATCH 8/8] Modify code for consistency --- README.md | 2 ++ requirements.txt | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 74c5a51f..a3361864 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ ----------------- + +[![pypi](https://img.shields.io/pypi/v/texar.svg)](https://pypi.python.org/pypi/texar) [![Build Status](https://travis-ci.org/asyml/texar.svg?branch=master)](https://travis-ci.org/asyml/texar) [![Documentation Status](https://readthedocs.org/projects/texar/badge/?version=latest)](https://texar.readthedocs.io/en/latest/?badge=latest) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/asyml/texar/blob/master/LICENSE) diff --git a/requirements.txt b/requirements.txt index 602e7747..325a4d2d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ -tensorflow >= 1.7.0 -tensorflow-gpu >= 1.7.0 +tensorflow >= 1.10.0 +tensorflow-gpu >= 1.10.0 tensorflow-probability >= 0.3.0 tensorflow-probability-gpu >= 0.3.0 -funcsigs >= 1.0.2 \ No newline at end of file +funcsigs >= 1.0.2 +packaging \ No newline at end of file