From ba023dfba8ef3ab1f4e1cb57a644a251037fe9df Mon Sep 17 00:00:00 2001 From: tangwei Date: Tue, 19 May 2020 11:39:23 +0800 Subject: [PATCH] fix import order --- core/engine/cluster/cluster.py | 4 ++-- core/engine/local_cluster.py | 8 +++++--- core/engine/local_mpi.py | 7 ++++--- core/metrics/auc_metrics.py | 2 ++ core/model.py | 1 + core/modules/modul/build.py | 3 ++- core/modules/modul/layers.py | 1 + core/trainer.py | 6 +++--- core/trainers/ctr_coding_trainer.py | 3 ++- core/trainers/ctr_modul_trainer.py | 6 +++--- core/trainers/online_learning_trainer.py | 2 +- core/trainers/single_trainer.py | 4 ++-- core/trainers/tdm_cluster_trainer.py | 2 ++ core/trainers/tdm_single_trainer.py | 5 +++-- core/utils/dataset.py | 2 +- core/utils/dataset_instance.py | 1 + core/utils/envs.py | 6 +++--- core/utils/fs.py | 1 + core/utils/util.py | 3 ++- models/contentunderstanding/classification/model.py | 3 +-- models/contentunderstanding/classification/reader.py | 2 +- models/contentunderstanding/tagspace/model.py | 5 +++-- models/contentunderstanding/tagspace/reader.py | 2 +- models/match/dssm/synthetic_reader.py | 1 + models/multitask/esmm/esmm_infer_reader.py | 6 +++--- models/multitask/esmm/esmm_reader.py | 6 +++--- models/multitask/esmm/model.py | 3 +-- models/multitask/mmoe/census_infer_reader.py | 3 +-- models/multitask/mmoe/census_reader.py | 3 +-- models/multitask/mmoe/model.py | 1 - models/multitask/share-bottom/census_infer_reader.py | 1 + models/rank/criteo_reader.py | 1 + models/rank/dcn/criteo_reader.py | 10 +++++++--- models/rank/dcn/model.py | 4 +++- models/rank/deepfm/criteo_reader.py | 7 +++++-- models/rank/deepfm/model.py | 3 ++- models/rank/din/reader.py | 10 +++++++--- models/rank/dnn/model.py | 1 + models/rank/wide_deep/model.py | 3 ++- models/rank/wide_deep/reader.py | 5 ++++- models/rank/xdeepfm/criteo_reader.py | 5 ++++- models/recall/gnn/evaluate_reader.py | 4 +++- models/recall/gnn/model.py | 3 ++- models/recall/gnn/reader.py | 4 +++- models/recall/gru4rec/rsc15_infer_reader.py | 1 + models/recall/gru4rec/rsc15_reader.py | 1 + models/recall/ssr/model.py | 5 ++--- models/recall/ssr/ssr_infer_reader.py | 5 ++++- models/recall/ssr/ssr_reader.py | 5 ++++- models/recall/word2vec/model.py | 1 - models/recall/word2vec/preprocess.py | 9 +++++++-- models/recall/word2vec/w2v_evaluate_reader.py | 3 +++ models/recall/word2vec/w2v_reader.py | 5 ++++- models/treebased/tdm/model.py | 2 +- run.py | 4 ++-- setup.py | 5 ++++- tools/tools.py | 9 +++++---- 57 files changed, 140 insertions(+), 78 deletions(-) diff --git a/core/engine/cluster/cluster.py b/core/engine/cluster/cluster.py index 3ce6bf66..6dfcec3a 100644 --- a/core/engine/cluster/cluster.py +++ b/core/engine/cluster/cluster.py @@ -15,9 +15,9 @@ from __future__ import print_function from __future__ import unicode_literals -import subprocess -import os import copy +import os +import subprocess from paddlerec.core.engine.engine import Engine from paddlerec.core.factory import TrainerFactory diff --git a/core/engine/local_cluster.py b/core/engine/local_cluster.py index 72d440a8..a0e4cf18 100755 --- a/core/engine/local_cluster.py +++ b/core/engine/local_cluster.py @@ -14,10 +14,12 @@ from __future__ import print_function from __future__ import unicode_literals -import subprocess -import sys -import os + import copy +import os +import sys +import subprocess + from paddlerec.core.engine.engine import Engine from paddlerec.core.utils import envs diff --git a/core/engine/local_mpi.py b/core/engine/local_mpi.py index 1f7a27a8..49db821f 100755 --- a/core/engine/local_mpi.py +++ b/core/engine/local_mpi.py @@ -14,10 +14,11 @@ from __future__ import print_function from __future__ import unicode_literals -import subprocess -import sys -import os + import copy +import os +import sys +import subprocess from paddlerec.core.engine.engine import Engine diff --git a/core/metrics/auc_metrics.py b/core/metrics/auc_metrics.py index 3c48040d..ece46a4d 100755 --- a/core/metrics/auc_metrics.py +++ b/core/metrics/auc_metrics.py @@ -13,8 +13,10 @@ # limitations under the License. import math + import numpy as np import paddle.fluid as fluid + from paddlerec.core.metric import Metric diff --git a/core/model.py b/core/model.py index fbafc695..c51ba241 100755 --- a/core/model.py +++ b/core/model.py @@ -15,6 +15,7 @@ import abc import paddle.fluid as fluid + from paddlerec.core.utils import envs diff --git a/core/modules/modul/build.py b/core/modules/modul/build.py index fe065678..0263cbf6 100755 --- a/core/modules/modul/build.py +++ b/core/modules/modul/build.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import yaml import copy + import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet +import yaml from paddlerec.core.model import Model from paddlerec.core.utils import table diff --git a/core/modules/modul/layers.py b/core/modules/modul/layers.py index f533a46d..c5827980 100755 --- a/core/modules/modul/layers.py +++ b/core/modules/modul/layers.py @@ -13,6 +13,7 @@ # limitations under the License. import paddle.fluid as fluid + from paddlerec.core.layer import Layer diff --git a/core/trainer.py b/core/trainer.py index df5626b7..40fc35de 100755 --- a/core/trainer.py +++ b/core/trainer.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import sys - import abc +import os import time +import sys import yaml from paddle import fluid + from paddlerec.core.utils import envs diff --git a/core/trainers/ctr_coding_trainer.py b/core/trainers/ctr_coding_trainer.py index a6377c85..e6979a92 100755 --- a/core/trainers/ctr_coding_trainer.py +++ b/core/trainers/ctr_coding_trainer.py @@ -11,9 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import os -import numpy as np +import numpy as np import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet from paddle.fluid.incubate.fleet.base.role_maker import MPISymetricRoleMaker diff --git a/core/trainers/ctr_modul_trainer.py b/core/trainers/ctr_modul_trainer.py index 8c99a5c8..d486767e 100755 --- a/core/trainers/ctr_modul_trainer.py +++ b/core/trainers/ctr_modul_trainer.py @@ -13,12 +13,12 @@ # limitations under the License. +import datetime +import json import sys import time -import json -import datetime -import numpy as np +import numpy as np import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.pslib import fleet from paddle.fluid.incubate.fleet.base.role_maker import GeneralRoleMaker diff --git a/core/trainers/online_learning_trainer.py b/core/trainers/online_learning_trainer.py index 1924b966..4a64d4c2 100755 --- a/core/trainers/online_learning_trainer.py +++ b/core/trainers/online_learning_trainer.py @@ -18,9 +18,9 @@ Training use fluid with one node only. from __future__ import print_function +import datetime import os import time -import datetime import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet diff --git a/core/trainers/single_trainer.py b/core/trainers/single_trainer.py index 888a93f3..e2f02f4b 100755 --- a/core/trainers/single_trainer.py +++ b/core/trainers/single_trainer.py @@ -17,14 +17,14 @@ Training use fluid with one node only. """ from __future__ import print_function -import logging + import time +import logging import paddle.fluid as fluid from paddlerec.core.trainers.transpiler_trainer import TranspileTrainer from paddlerec.core.utils import envs -import numpy as np logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s") logger = logging.getLogger("fluid") diff --git a/core/trainers/tdm_cluster_trainer.py b/core/trainers/tdm_cluster_trainer.py index 60e87bfd..1ce2dfc9 100755 --- a/core/trainers/tdm_cluster_trainer.py +++ b/core/trainers/tdm_cluster_trainer.py @@ -17,7 +17,9 @@ Training use fluid with one node only. """ from __future__ import print_function + import logging + import numpy as np import paddle.fluid as fluid from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet diff --git a/core/trainers/tdm_single_trainer.py b/core/trainers/tdm_single_trainer.py index 8890ffd7..1e7700f3 100755 --- a/core/trainers/tdm_single_trainer.py +++ b/core/trainers/tdm_single_trainer.py @@ -18,11 +18,12 @@ Training use fluid with one node only. from __future__ import print_function import logging -import paddle.fluid as fluid +import numpy as np +import paddle.fluid as fluid from paddlerec.core.trainers.single_trainer import SingleTrainer from paddlerec.core.utils import envs -import numpy as np + logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s") logger = logging.getLogger("fluid") diff --git a/core/utils/dataset.py b/core/utils/dataset.py index 0eff8da0..c02fb3d3 100755 --- a/core/utils/dataset.py +++ b/core/utils/dataset.py @@ -13,8 +13,8 @@ # limitations under the License. import abc -import time import datetime +import time import paddle.fluid as fluid diff --git a/core/utils/dataset_instance.py b/core/utils/dataset_instance.py index 94997b66..731b3b47 100755 --- a/core/utils/dataset_instance.py +++ b/core/utils/dataset_instance.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function import sys diff --git a/core/utils/envs.py b/core/utils/envs.py index 084cec0b..4fe57b32 100755 --- a/core/utils/envs.py +++ b/core/utils/envs.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os +from contextlib import closing import copy -import sys +import os import socket -from contextlib import closing +import sys global_envs = {} diff --git a/core/utils/fs.py b/core/utils/fs.py index df237972..a1f5a843 100755 --- a/core/utils/fs.py +++ b/core/utils/fs.py @@ -13,6 +13,7 @@ # limitations under the License. import os + from paddle.fluid.incubate.fleet.utils.hdfs import HDFSClient diff --git a/core/utils/util.py b/core/utils/util.py index 76965f50..bd632848 100755 --- a/core/utils/util.py +++ b/core/utils/util.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import datetime import os import time -import datetime from paddle import fluid + from paddlerec.core.utils import fs as fs diff --git a/models/contentunderstanding/classification/model.py b/models/contentunderstanding/classification/model.py index 46869b44..18db63a5 100644 --- a/models/contentunderstanding/classification/model.py +++ b/models/contentunderstanding/classification/model.py @@ -12,11 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +import paddle.fluid as fluid from paddlerec.core.model import Model as ModelBase -import paddle.fluid as fluid - class Model(ModelBase): def __init__(self, config): diff --git a/models/contentunderstanding/classification/reader.py b/models/contentunderstanding/classification/reader.py index 8c3f5486..72b1837a 100644 --- a/models/contentunderstanding/classification/reader.py +++ b/models/contentunderstanding/classification/reader.py @@ -15,9 +15,9 @@ import sys - from paddlerec.core.reader import Reader + class TrainReader(Reader): def init(self): pass diff --git a/models/contentunderstanding/tagspace/model.py b/models/contentunderstanding/tagspace/model.py index 7ed1fcf3..eb01efba 100644 --- a/models/contentunderstanding/tagspace/model.py +++ b/models/contentunderstanding/tagspace/model.py @@ -12,13 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddlerec.core.model import Model as ModelBase - import paddle.fluid as fluid import paddle.fluid.layers.nn as nn import paddle.fluid.layers.tensor as tensor import paddle.fluid.layers.control_flow as cf +from paddlerec.core.model import Model as ModelBase + + class Model(ModelBase): def __init__(self, config): ModelBase.__init__(self, config) diff --git a/models/contentunderstanding/tagspace/reader.py b/models/contentunderstanding/tagspace/reader.py index 8c912a68..596a9a13 100644 --- a/models/contentunderstanding/tagspace/reader.py +++ b/models/contentunderstanding/tagspace/reader.py @@ -14,10 +14,10 @@ import sys + import numpy as np from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs class TrainReader(Reader): def init(self): diff --git a/models/match/dssm/synthetic_reader.py b/models/match/dssm/synthetic_reader.py index cc829374..25c2e43b 100755 --- a/models/match/dssm/synthetic_reader.py +++ b/models/match/dssm/synthetic_reader.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader diff --git a/models/multitask/esmm/esmm_infer_reader.py b/models/multitask/esmm/esmm_infer_reader.py index 6e94a1ee..416c7a67 100644 --- a/models/multitask/esmm/esmm_infer_reader.py +++ b/models/multitask/esmm/esmm_infer_reader.py @@ -13,10 +13,10 @@ # limitations under the License. from __future__ import print_function -from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs from collections import defaultdict -import numpy as np + +from paddlerec.core.reader import Reader + class EvaluateReader(Reader): diff --git a/models/multitask/esmm/esmm_reader.py b/models/multitask/esmm/esmm_reader.py index f7aef643..b0bed00f 100644 --- a/models/multitask/esmm/esmm_reader.py +++ b/models/multitask/esmm/esmm_reader.py @@ -11,12 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function -from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs from collections import defaultdict -import numpy as np + +from paddlerec.core.reader import Reader class TrainReader(Reader): diff --git a/models/multitask/esmm/model.py b/models/multitask/esmm/model.py index 1641f72d..dc68f7cf 100644 --- a/models/multitask/esmm/model.py +++ b/models/multitask/esmm/model.py @@ -12,12 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math +import numpy as np import paddle.fluid as fluid from paddlerec.core.utils import envs from paddlerec.core.model import Model as ModelBase -import numpy as np class Model(ModelBase): diff --git a/models/multitask/mmoe/census_infer_reader.py b/models/multitask/mmoe/census_infer_reader.py index c25ccea8..c62de8e6 100644 --- a/models/multitask/mmoe/census_infer_reader.py +++ b/models/multitask/mmoe/census_infer_reader.py @@ -11,11 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs -import numpy as np class EvaluateReader(Reader): diff --git a/models/multitask/mmoe/census_reader.py b/models/multitask/mmoe/census_reader.py index 30997c63..abe6ba9a 100644 --- a/models/multitask/mmoe/census_reader.py +++ b/models/multitask/mmoe/census_reader.py @@ -11,11 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs -import numpy as np class TrainReader(Reader): diff --git a/models/multitask/mmoe/model.py b/models/multitask/mmoe/model.py index 753bacae..7f54dda4 100644 --- a/models/multitask/mmoe/model.py +++ b/models/multitask/mmoe/model.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math import paddle.fluid as fluid from paddlerec.core.utils import envs diff --git a/models/multitask/share-bottom/census_infer_reader.py b/models/multitask/share-bottom/census_infer_reader.py index d4071a1b..c62de8e6 100644 --- a/models/multitask/share-bottom/census_infer_reader.py +++ b/models/multitask/share-bottom/census_infer_reader.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader diff --git a/models/rank/criteo_reader.py b/models/rank/criteo_reader.py index 3d8fcf96..75994fb4 100755 --- a/models/rank/criteo_reader.py +++ b/models/rank/criteo_reader.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader diff --git a/models/rank/dcn/criteo_reader.py b/models/rank/dcn/criteo_reader.py index 5c180ee2..fde9e882 100755 --- a/models/rank/dcn/criteo_reader.py +++ b/models/rank/dcn/criteo_reader.py @@ -11,16 +11,20 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function import math +import os -from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs try: import cPickle as pickle except ImportError: import pickle -import os + + +from paddlerec.core.reader import Reader +from paddlerec.core.utils import envs + class TrainReader(Reader): def init(self): diff --git a/models/rank/dcn/model.py b/models/rank/dcn/model.py index d9292492..c34939ae 100755 --- a/models/rank/dcn/model.py +++ b/models/rank/dcn/model.py @@ -12,11 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from collections import OrderedDict + import paddle.fluid as fluid from paddlerec.core.utils import envs from paddlerec.core.model import Model as ModelBase -from collections import OrderedDict + class Model(ModelBase): def __init__(self, config): diff --git a/models/rank/deepfm/criteo_reader.py b/models/rank/deepfm/criteo_reader.py index ae942e0a..87692ff9 100755 --- a/models/rank/deepfm/criteo_reader.py +++ b/models/rank/deepfm/criteo_reader.py @@ -11,15 +11,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function -from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs try: import cPickle as pickle except ImportError: import pickle +from paddlerec.core.reader import Reader +from paddlerec.core.utils import envs + + class TrainReader(Reader): def init(self): self.cont_min_ = [0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] diff --git a/models/rank/deepfm/model.py b/models/rank/deepfm/model.py index 8636078d..ea246968 100755 --- a/models/rank/deepfm/model.py +++ b/models/rank/deepfm/model.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.fluid as fluid import math +import paddle.fluid as fluid + from paddlerec.core.utils import envs from paddlerec.core.model import Model as ModelBase diff --git a/models/rank/din/reader.py b/models/rank/din/reader.py index d1742bdd..44fa4a7c 100755 --- a/models/rank/din/reader.py +++ b/models/rank/din/reader.py @@ -13,16 +13,20 @@ # limitations under the License. from __future__ import print_function -from paddlerec.core.reader import Reader -from paddlerec.core.utils import envs -import numpy as np import os import random + try: import cPickle as pickle except ImportError: import pickle +import numpy as np + +from paddlerec.core.reader import Reader +from paddlerec.core.utils import envs + + class TrainReader(Reader): def init(self): self.train_data_path = envs.get_global_env("train_data_path", None, "train.reader") diff --git a/models/rank/dnn/model.py b/models/rank/dnn/model.py index 7a5ed0d4..67bf61a0 100755 --- a/models/rank/dnn/model.py +++ b/models/rank/dnn/model.py @@ -13,6 +13,7 @@ # limitations under the License. import math + import paddle.fluid as fluid from paddlerec.core.utils import envs diff --git a/models/rank/wide_deep/model.py b/models/rank/wide_deep/model.py index 8e39cafc..a74bde09 100755 --- a/models/rank/wide_deep/model.py +++ b/models/rank/wide_deep/model.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.fluid as fluid import math +import paddle.fluid as fluid + from paddlerec.core.utils import envs from paddlerec.core.model import Model as ModelBase diff --git a/models/rank/wide_deep/reader.py b/models/rank/wide_deep/reader.py index f2a1058f..633dce6e 100755 --- a/models/rank/wide_deep/reader.py +++ b/models/rank/wide_deep/reader.py @@ -11,14 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function -from paddlerec.core.reader import Reader try: import cPickle as pickle except ImportError: import pickle +from paddlerec.core.reader import Reader + + class TrainReader(Reader): def init(self): pass diff --git a/models/rank/xdeepfm/criteo_reader.py b/models/rank/xdeepfm/criteo_reader.py index 237d7d6d..6bf3290f 100755 --- a/models/rank/xdeepfm/criteo_reader.py +++ b/models/rank/xdeepfm/criteo_reader.py @@ -11,14 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function -from paddlerec.core.reader import Reader try: import cPickle as pickle except ImportError: import pickle +from paddlerec.core.reader import Reader + + class TrainReader(Reader): def init(self): pass diff --git a/models/recall/gnn/evaluate_reader.py b/models/recall/gnn/evaluate_reader.py index 4ced177e..fa28fa63 100755 --- a/models/recall/gnn/evaluate_reader.py +++ b/models/recall/gnn/evaluate_reader.py @@ -12,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np import copy import random + +import numpy as np + from paddlerec.core.reader import Reader from paddlerec.core.utils import envs diff --git a/models/recall/gnn/model.py b/models/recall/gnn/model.py index ac628ec6..1228e6b0 100755 --- a/models/recall/gnn/model.py +++ b/models/recall/gnn/model.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np import math +import numpy as np + import paddle.fluid as fluid import paddle.fluid.layers as layers diff --git a/models/recall/gnn/reader.py b/models/recall/gnn/reader.py index d9aab524..ad6f63dd 100755 --- a/models/recall/gnn/reader.py +++ b/models/recall/gnn/reader.py @@ -12,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np import copy import random + +import numpy as np + from paddlerec.core.reader import Reader from paddlerec.core.utils import envs diff --git a/models/recall/gru4rec/rsc15_infer_reader.py b/models/recall/gru4rec/rsc15_infer_reader.py index 4bde64cb..b58532a4 100644 --- a/models/recall/gru4rec/rsc15_infer_reader.py +++ b/models/recall/gru4rec/rsc15_infer_reader.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader diff --git a/models/recall/gru4rec/rsc15_reader.py b/models/recall/gru4rec/rsc15_reader.py index 0abd6f41..4fe9433a 100644 --- a/models/recall/gru4rec/rsc15_reader.py +++ b/models/recall/gru4rec/rsc15_reader.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function from paddlerec.core.reader import Reader diff --git a/models/recall/ssr/model.py b/models/recall/ssr/model.py index e11e0cf1..ac986128 100644 --- a/models/recall/ssr/model.py +++ b/models/recall/ssr/model.py @@ -13,12 +13,11 @@ # limitations under the License. import paddle.fluid as fluid - -from paddlerec.core.utils import envs -from paddlerec.core.model import Model as ModelBase import paddle.fluid.layers.tensor as tensor import paddle.fluid.layers.control_flow as cf +from paddlerec.core.utils import envs +from paddlerec.core.model import Model as ModelBase class BowEncoder(object): diff --git a/models/recall/ssr/ssr_infer_reader.py b/models/recall/ssr/ssr_infer_reader.py index 5a40280b..40e1bf6d 100644 --- a/models/recall/ssr/ssr_infer_reader.py +++ b/models/recall/ssr/ssr_infer_reader.py @@ -11,11 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function +import numpy as np + from paddlerec.core.reader import Reader from paddlerec.core.utils import envs -import numpy as np + class EvaluateReader(Reader): diff --git a/models/recall/ssr/ssr_reader.py b/models/recall/ssr/ssr_reader.py index ba004575..12e8bfb2 100644 --- a/models/recall/ssr/ssr_reader.py +++ b/models/recall/ssr/ssr_reader.py @@ -11,11 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from __future__ import print_function -from paddlerec.core.reader import Reader import random +from paddlerec.core.reader import Reader + + class TrainReader(Reader): def init(self): diff --git a/models/recall/word2vec/model.py b/models/recall/word2vec/model.py index ea8e0f5e..bf09a046 100755 --- a/models/recall/word2vec/model.py +++ b/models/recall/word2vec/model.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math import numpy as np import paddle.fluid as fluid diff --git a/models/recall/word2vec/preprocess.py b/models/recall/word2vec/preprocess.py index 592f9755..07d7b345 100755 --- a/models/recall/word2vec/preprocess.py +++ b/models/recall/word2vec/preprocess.py @@ -13,13 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +import io +import math import os import random import re import six + + import argparse -import io -import math + + + prog = re.compile("[^a-z ]", flags=0) diff --git a/models/recall/word2vec/w2v_evaluate_reader.py b/models/recall/word2vec/w2v_evaluate_reader.py index 96d483db..548fbedd 100755 --- a/models/recall/word2vec/w2v_evaluate_reader.py +++ b/models/recall/word2vec/w2v_evaluate_reader.py @@ -11,8 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import io + import six + from paddlerec.core.reader import Reader from paddlerec.core.utils import envs diff --git a/models/recall/word2vec/w2v_reader.py b/models/recall/word2vec/w2v_reader.py index 609a516a..128e31e9 100755 --- a/models/recall/word2vec/w2v_reader.py +++ b/models/recall/word2vec/w2v_reader.py @@ -11,8 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np + import io + +import numpy as np + from paddlerec.core.reader import Reader from paddlerec.core.utils import envs diff --git a/models/treebased/tdm/model.py b/models/treebased/tdm/model.py index 0fc1adf9..3ce23eec 100755 --- a/models/treebased/tdm/model.py +++ b/models/treebased/tdm/model.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. """ + import paddle.fluid as fluid -import math from paddlerec.core.utils import envs from paddlerec.core.model import Model as ModelBase diff --git a/run.py b/run.py index 6c0e06f7..56999935 100755 --- a/run.py +++ b/run.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import argparse import os import subprocess -import tempfile +import argparse +import tempfile import yaml from paddlerec.core.factory import TrainerFactory diff --git a/setup.py b/setup.py index ab0c2792..a368bc3d 100644 --- a/setup.py +++ b/setup.py @@ -15,10 +15,13 @@ """ setup for paddle-rec. """ + import os + from setuptools import setup, find_packages -import tempfile import shutil +import tempfile + requires = [ "paddlepaddle == 1.7.2", diff --git a/tools/tools.py b/tools/tools.py index ec85326c..8508a790 100644 --- a/tools/tools.py +++ b/tools/tools.py @@ -12,15 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +import functools import os -import time +import platform +import sys import shutil +import time + import requests -import sys import tarfile import zipfile -import platform -import functools lasttime = time.time() FLUSH_INTERVAL = 0.1 -- GitLab