Skip to content

Commit c450185

Browse files
committed
Remove __future__ imports
1 parent caa931a commit c450185

File tree

197 files changed

+0
-812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+0
-812
lines changed

examples/bert/bert_classifier_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
"""Example of building a sentence classifier based on pre-trained BERT model.
1515
"""
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
2117
import os
2218
import importlib
2319
import tensorflow as tf

examples/bert/prepare_data.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
"""Produces TFRecord files and modifies data configuration file
1515
"""
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
2117
import os
2218
import tensorflow as tf
2319
import texar.tf as tx

examples/distributed_gpu/lm_ptb_distributed.py

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
4242
$ python lm_ptb.py --data_path=simple-examples/data --config=config_small
4343
"""
44-
from __future__ import absolute_import
45-
from __future__ import division
46-
from __future__ import print_function
4744

4845
# pylint: disable=invalid-name, no-member, too-many-locals
4946

examples/distributed_gpu/ptb_reader.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Utilities for preprocessing and iterating over the PTB data.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
# pylint: disable=invalid-name, too-many-locals
2118

examples/gpt-2/gpt2_generate_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
"""Example of building OpenAI GPT-2 language model for sample generation.
1515
"""
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
2117
import importlib
2218
import numpy as np
2319
import tensorflow as tf

examples/gpt-2/gpt2_train_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
"""Example of fine-tuning OpenAI GPT-2 language model.
1515
"""
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
2117
import os
2218
import importlib
2319
import tensorflow as tf

examples/gpt-2/prepare_data.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
"""Preprocesses raw data and produces TFRecord files
1515
"""
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
2117
import tensorflow as tf
2218
import texar.tf as tx
2319

examples/hierarchical_dialog/hred.py

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
"""Hierarchical Recurrent Encoder-Decoder (HRED) for dialog response
1515
generation.
1616
"""
17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
2017

2118
# pylint: disable=invalid-name, too-many-locals
2219

examples/language_model_ptb/lm_ptb.py

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
4242
$ python lm_ptb.py --data_path=simple-examples/data --config=config_small
4343
"""
44-
from __future__ import absolute_import
45-
from __future__ import division
46-
from __future__ import print_function
4744

4845
# pylint: disable=invalid-name, no-member, too-many-locals
4946

examples/language_model_ptb/ptb_reader.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Utilities for preprocessing and iterating over the PTB data.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
# pylint: disable=invalid-name, too-many-locals
2118

examples/memory_network_lm/lm_ptb_memnet.py

-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
This code will automatically save and restore from directory `ckpt/`.
3333
If the directory doesn't exist, it will be created automatically.
3434
"""
35-
from __future__ import absolute_import
36-
from __future__ import division
37-
from __future__ import print_function
3835

3936
# pylint: disable=invalid-name, no-member, too-many-locals
4037

examples/memory_network_lm/ptb_reader.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Utilities for preprocessing and iterating over the PTB data.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
# pylint: disable=invalid-name, too-many-locals
2118

examples/rl_gym/ac_cartpole.py

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
"""
1515
Policy gradient for the CartPole game in OpenAI gym.
1616
"""
17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
2017

2118
# pylint: disable=invalid-name
2219

examples/rl_gym/dqn_cartpole.py

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
"""
1515
Policy gradient for the CartPole game in OpenAI gym.
1616
"""
17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
2017

2118
# pylint: disable=invalid-name
2219

examples/rl_gym/pg_cartpole.py

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
"""
1515
Policy gradient for the CartPole game in OpenAI gym.
1616
"""
17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
2017

2118
# pylint: disable=invalid-name
2219

examples/sentence_classifier/clas_main.py

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
2020
$ python clas_main.py --config=config_kim
2121
"""
22-
from __future__ import absolute_import
23-
from __future__ import division
24-
from __future__ import print_function
2522

2623
import importlib
2724
import tensorflow as tf

examples/sentence_classifier/sst_data_preprocessor.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Preparing the SST2 dataset.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
import os
2118
import re

examples/seq2seq_attn/seq2seq_attn.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Attentional Seq2seq.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import print_function
18-
from __future__ import division
1916

2017
# pylint: disable=invalid-name, too-many-arguments, too-many-locals
2118

examples/seq2seq_exposure_bias/baseline_seq2seq_attn_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
Attentional Seq2seq.
1616
same as examples/seq2seq_attn except that here Rouge is also supported.
1717
"""
18-
from __future__ import absolute_import
19-
from __future__ import print_function
20-
from __future__ import division
21-
from __future__ import unicode_literals
2218

2319
# pylint: disable=invalid-name, too-many-arguments, too-many-locals
2420

examples/seq2seq_exposure_bias/interpolation_decoder.py

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
which stores one more variable in 'state' recording the
1717
decoded ids(state: [decoded_ids, rnn_state]).
1818
"""
19-
from __future__ import absolute_import
20-
from __future__ import division
21-
from __future__ import print_function
2219

2320
# pylint: disable=no-name-in-module, too-many-arguments, too-many-locals
2421
# pylint: disable=not-context-manager, protected-access, invalid-name

examples/seq2seq_exposure_bias/interpolation_helper.py

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
Helper for interpolation algirithm.
1616
New token is sample from model, ground_truth or reward according to lambdas
1717
"""
18-
from __future__ import absolute_import
19-
from __future__ import division
20-
from __future__ import print_function
2118

2219
import tensorflow as tf
2320
import numpy as np

examples/seq2seq_exposure_bias/interpolation_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
"""Interpolation Algorithm.
1616
"""
17-
from __future__ import absolute_import
18-
from __future__ import print_function
19-
from __future__ import division
20-
from __future__ import unicode_literals
2117

2218
import importlib
2319
from io import open

examples/seq2seq_exposure_bias/raml_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
RAML Algorithm is described in https://arxiv.org/pdf/1705.07136.pdf
2222
2323
"""
24-
from __future__ import absolute_import
25-
from __future__ import print_function
26-
from __future__ import division
27-
from __future__ import unicode_literals
2824

2925
from io import open
3026
import importlib

examples/seq2seq_exposure_bias/scheduled_sampling_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
2020
Scheduled Sampling Algorithm is described in https://arxiv.org/abs/1506.03099
2121
"""
22-
from __future__ import absolute_import
23-
from __future__ import print_function
24-
from __future__ import division
25-
from __future__ import unicode_literals
2622

2723
# pylint: disable=invalid-name, too-many-arguments, too-many-locals
2824

examples/seq2seq_exposure_bias/utils/raml_samples_generation/process_samples.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function
21
from nltk.translate.bleu_score import sentence_bleu
32
from nltk.translate.bleu_score import SmoothingFunction
43
import sys

examples/seq2seq_exposure_bias/utils/raml_samples_generation/vocab.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function
21
import argparse
32
from collections import Counter
43
from itertools import chain

examples/seq2seq_rl/seq2seq_attn_pg.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Attentional Seq2seq trained with policy gradient.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import print_function
18-
from __future__ import division
1916

2017
# pylint: disable=invalid-name, too-many-arguments, too-many-locals
2118

examples/seqgan/seqgan_train.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""SeqGAN for language modeling
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
# pylint: disable=invalid-name, no-member, too-many-locals
2118

examples/sequence_tagging/conll_reader.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Utilities for preprocessing and iterating over the CoNLL 2003 data.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
import re
2118
from collections import defaultdict

examples/sequence_tagging/ner.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Sequence tagging.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
import os
2118
import time

examples/text_style_transfer/config.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""Config
22
"""
3-
from __future__ import absolute_import
4-
from __future__ import division
5-
from __future__ import print_function
63

74
# pylint: disable=invalid-name
85

examples/text_style_transfer/ctrl_gen_model.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Text style transfer
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
1916

2017
# pylint: disable=invalid-name, too-many-locals
2118

examples/text_style_transfer/main.py

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
2727
$ python main.py --config config
2828
"""
29-
from __future__ import absolute_import
30-
from __future__ import division
31-
from __future__ import print_function
3229

3330
# pylint: disable=invalid-name, too-many-locals, too-many-arguments, no-member
3431

examples/torchtext/lm_torchtext.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
""" Language Modeling example using torchtext
1515
"""
1616

17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
2117
import time
2218
import importlib
2319
import numpy as np

examples/transformer/bleu_tool.py

-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
# BLEU score will be similar to the one obtained using: mteval-v14.pl
2727
# Note:compound splitting is not implemented in this module
2828

29-
from __future__ import absolute_import
30-
from __future__ import division
31-
from __future__ import print_function
32-
from __future__ import unicode_literals
33-
3429
from argparse import ArgumentParser
3530
from io import open
3631
import collections

examples/transformer/transformer_main.py

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# limitations under the License.
1414
"""Transformer model.
1515
"""
16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
19-
from __future__ import unicode_literals
2016

2117
import pickle
2218
import random

examples/transformer/utils/preprocess.py

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
preprocessing text data. Generally it's to generate plain text vocab file,
1616
truncate sequence by length, generate the preprocessed dataset.
1717
"""
18-
from __future__ import unicode_literals
1918
import collections
2019
import re
2120
import json

examples/transformer/utils/utils.py

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
"""
1515
Helper functions for model training.
1616
"""
17-
from __future__ import absolute_import
18-
from __future__ import division
19-
from __future__ import print_function
20-
from __future__ import unicode_literals
2117

2218
import random
2319
import math

examples/vae_text/vae_train.py

-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
Hyperparameters and data path may be specified in config_trans.py
2323
2424
"""
25-
from __future__ import absolute_import
26-
from __future__ import division
27-
from __future__ import print_function
28-
from __future__ import unicode_literals
2925

3026
# pylint: disable=invalid-name, no-member, too-many-locals
3127
# pylint: disable=too-many-branches, too-many-statements, redefined-variable-type

0 commit comments

Comments
 (0)