diff --git a/doc/howto/cmd_parameter/arguments.md b/doc/howto/cmd_parameter/arguments.md index d6cc2c6ed7cc1b9209d56b4348497427efe40ac3..013edbc9047817d7f6b82c4d5188412bd2ce41d6 100644 --- a/doc/howto/cmd_parameter/arguments.md +++ b/doc/howto/cmd_parameter/arguments.md @@ -143,7 +143,7 @@ It looks like there are a lot of arguments. However, most of them are for develo -testing during trainingtest_all_data_in_one_period +testing during trainingtest_period √√ diff --git a/doc/howto/cmd_parameter/detail_introduction.md b/doc/howto/cmd_parameter/detail_introduction.md index 07608e5edf740bd3e1242913f1d2d7589ad313aa..510396b629e398cef2ccda2f1cec474160693219 100644 --- a/doc/howto/cmd_parameter/detail_introduction.md +++ b/doc/howto/cmd_parameter/detail_introduction.md @@ -31,7 +31,7 @@ - type: string (default: null). * `--version` - - Whether to print version infomatrion. + - Whether to print version information. - type: bool (default: 0). * `--show_layer_stat` @@ -110,8 +110,8 @@ - type: int32 (default: -1). * `--test_period` - - Run testing every test_period train batches. If not set, run testing each pass. - - type: int32 (default: 1000). + - if equal 0, do test on all test data at the end of each pass. While if equal non-zero, do test on all test data every test_period batches. + - type: int32 (default: 0). * `--test_wait` - Whether to wait for parameter per pass if not exist. If set test_data_path in submitting environment of cluster, it will launch one process to perfom testing, so we need to set test_wait=1. Note that in the cluster submitting environment, this argument has been set True by default. @@ -121,10 +121,6 @@ - File that saves the model list when testing. It was set automatically when using cluster submitting environment after setting model_path. - type: string (default: "", null). -* `--test_all_data_in_one_period` - - This argument is usually used in testing period during traning. If true, all data will be tested in one test period. Otherwise (batch_size * log_peroid) data will be tested. - - type: bool (default: 0). - * `--predict_output_dir` - Directory that saves the layer output. It is configured in Outputs() in network config. Default, this argument is null, meaning save nothing. Specify this directory if you want to save feature map of some layers in testing mode. Note that, layer outputs are values after activation function. - type: string (default: "", null). diff --git a/doc/howto/cmd_parameter/use_case.md b/doc/howto/cmd_parameter/use_case.md index a6bfba29af4f73055338c3a671bcafaa1456c7cf..4d7bb33f36fe258ee24796eedc9296065923e58f 100644 --- a/doc/howto/cmd_parameter/use_case.md +++ b/doc/howto/cmd_parameter/use_case.md @@ -10,9 +10,8 @@ paddle train \ --config=network_config \ --save_dir=output \ --trainer_count=COUNT \ #(default:1) - --test_period=M \ #(default:1000) - --test_all_data_in_one_period=true \ #(default:false) - --num_passes=N \ #(defalut:100) + --test_period=M \ #(default:0) + --num_passes=N \ #(defalut:100) --log_period=K \ #(default:100) --dot_period=1000 \ #(default:1) #[--show_parameter_stats_period=100] \ #(default:0) diff --git a/paddle/trainer/Tester.cpp b/paddle/trainer/Tester.cpp index 30e92682baec2fc6035ecfa9dbd90415acd5abe1..db7916cf1413d19dd82062886d7adeeb1a3aa61f 100644 --- a/paddle/trainer/Tester.cpp +++ b/paddle/trainer/Tester.cpp @@ -87,10 +87,8 @@ void Tester::testOneDataBatch(const DataBatch& dataBatch, void Tester::testOnePeriod() { DataBatch dataBatch; int64_t batchSize = config_->getOptConfig().batch_size(); - bool testAllData = - intconfig_->testPeriod == 0 || intconfig_->testAllDataInOnePeriod; - int batches = - testAllData ? std::numeric_limits::max() : intconfig_->testPeriod; + + int batches = std::numeric_limits::max(); std::vector outArgs; @@ -102,11 +100,7 @@ void Tester::testOnePeriod() { if (intconfig_->prevBatchState) { gradientMachine_->resetState(); } - if (testAllData) { - break; - } else { - num = testDataProvider_->getNextBatch(batchSize, &dataBatch); - } + break; } testOneDataBatch(dataBatch, &outArgs); } diff --git a/paddle/trainer/TesterConfig.h b/paddle/trainer/TesterConfig.h index 90267e68d768f2a144e0041d0f493072ef9eb9a1..f490e5734415c0939fd925a6c7dd34c1e6d3a34f 100644 --- a/paddle/trainer/TesterConfig.h +++ b/paddle/trainer/TesterConfig.h @@ -39,11 +39,6 @@ struct TesterConfig { */ int testPeriod; - /** - * indicate whether testing data in one period - */ - bool testAllDataInOnePeriod; - /** * indicate whether to save previous batch state */ diff --git a/paddle/trainer/Trainer.cpp b/paddle/trainer/Trainer.cpp index a361386b90235162f5e1c4e5936d384dde33b455..99bf45d247a9c61819ba92147616cb7ff75f89fb 100644 --- a/paddle/trainer/Trainer.cpp +++ b/paddle/trainer/Trainer.cpp @@ -39,20 +39,16 @@ limitations under the License. */ #include "TrainerConfigHelper.h" P_DEFINE_string(config, "", "Trainer config file"); -P_DEFINE_int32(test_period, - 0, - "Run test every so many train batches." - " 0 for testing after each pass." - " If not 0, test log_period batches." - " If 0, test on all test data"); -P_DEFINE_bool(local, true, "Train in local mode or not"); +P_DEFINE_int32(test_period, 0, + "if equal 0, do test on all test data at the end of " + "each pass. While if equal non-zero, do test on all test " + "data every test_period batches"); +P_DEFINE_bool(test_all_data_in_one_period, false, + "This option was deprecated, since we will always do " + "test on all test set "); -P_DEFINE_bool( - test_all_data_in_one_period, - false, - "true will test all data in one test peroid." - "Otherwise test (batch_size * log_peroid) data in one test period."); +P_DEFINE_bool(local, true, "Train in local mode or not"); P_DEFINE_int32(average_test_period, 0, @@ -633,8 +629,19 @@ void Trainer::test() { tester_->test(); } std::unique_ptr Trainer::createTesterConfig() { TesterConfig* conf = new TesterConfig; + if (FLAGS_test_period) { + LOG(WARNING) + << "The meaning of --test_period is changed: " + << "if equal 0, do test on all test data at the end of " + << "each pass. While if equal non-zero, do test on all test " + << "data every test_period batches "; + } + if (FLAGS_test_all_data_in_one_period) { + LOG(WARNING) + << "--test_all_data_in_one_period was deprecated, since " + << "we will always do test on all test set "; + } conf->testPeriod = FLAGS_test_period; - conf->testAllDataInOnePeriod = FLAGS_test_all_data_in_one_period; conf->prevBatchState = FLAGS_prev_batch_state; conf->logPeriod = FLAGS_log_period; conf->loadsaveParametersInPserver = FLAGS_loadsave_parameters_in_pserver;