diff --git a/fluid/language_model/train.py b/fluid/language_model/train.py index f3e7a7398bf13e14c74ce1d10d90b7bf34031698..e719f8f107852f79972c1ad59b7388b52295691e 100644 --- a/fluid/language_model/train.py +++ b/fluid/language_model/train.py @@ -145,7 +145,7 @@ def train(train_reader, if pass_idx == pass_num - 1 and args.enable_ce: #Note: The following logs are special for CE monitoring. #Other situations do not need to care about these logs. - gpu_num = get_cards() + gpu_num = get_cards(args.enable_ce) if gpu_num == 1: print("kpis imikolov_20_pass_duration %s" % (total_time / epoch_idx)) diff --git a/fluid/text_classification/infer.py b/fluid/text_classification/infer.py index d2a0363d786866a92195dba8b490287b3ca9bc9d..923dd98dc27f6a4c5e369f30d9aca49e63aea7a5 100644 --- a/fluid/text_classification/infer.py +++ b/fluid/text_classification/infer.py @@ -4,8 +4,8 @@ import unittest import contextlib import numpy as np +import paddle import paddle.fluid as fluid -import paddle.v2 as paddle import utils diff --git a/fluid/text_classification/train.py b/fluid/text_classification/train.py index 698e4dc0788f2e185810a4f782ac4dcff1f60c81..9078f4788319dbf76677c86eef53445fa1e85c1a 100644 --- a/fluid/text_classification/train.py +++ b/fluid/text_classification/train.py @@ -4,8 +4,8 @@ import time import unittest import contextlib +import paddle import paddle.fluid as fluid -import paddle.v2 as paddle import utils from nets import bow_net @@ -55,7 +55,7 @@ def train(train_reader, feeder = fluid.DataFeeder(feed_list=[data, label], place=place) # For internal continuous evaluation - if 'CE_MODE_X' in os.environ: + if "CE_MODE_X" in os.environ: fluid.default_startup_program().random_seed = 110 exe.run(fluid.default_startup_program()) for pass_id in xrange(pass_num): @@ -80,7 +80,7 @@ def train(train_reader, pass_end = time.time() # For internal continuous evaluation - if 'CE_MODE_X' in os.environ: + if "CE_MODE_X" in os.environ: print("kpis train_acc %f" % avg_acc) print("kpis train_cost %f" % avg_cost) print("kpis train_duration %f" % (pass_end - pass_start)) diff --git a/fluid/text_classification/utils.py b/fluid/text_classification/utils.py index 874679c3e2f9fe0c640d6da4f25d503023adcb65..3c2fc559e7b257731c1dcfcb239a04b4846d1097 100644 --- a/fluid/text_classification/utils.py +++ b/fluid/text_classification/utils.py @@ -65,7 +65,7 @@ def prepare_data(data_type="imdb", raise RuntimeError("No such dataset") if data_type == "imdb": - if 'CE_MODE_X' in os.environ: + if "CE_MODE_X" in os.environ: train_reader = paddle.batch( paddle.dataset.imdb.train(word_dict), batch_size=batch_size)