diff --git a/core/trainers/framework/runner.py b/core/trainers/framework/runner.py index b7c67cd1d4f1b8702b1554e042114fb5e413b824..4375b7267359e50e8cf9d739ba9dc1f58529e36a 100644 --- a/core/trainers/framework/runner.py +++ b/core/trainers/framework/runner.py @@ -174,18 +174,20 @@ class RunnerBase(object): fetch_list=metrics_varnames, return_numpy=False) + metrics = [batch_id] + metrics_rets = [ + as_numpy(metrics_tensor) + for metrics_tensor in metrics_tensors + ] + metrics.extend(metrics_rets) + if batch_id % fetch_period == 0 and batch_id != 0: - metrics = [batch_id] end_time = time.time() seconds = end_time - begin_time - metrics.extend([seconds]) + metrics_logging = metrics[:] + metrics_logging = metrics.insert(1, seconds) begin_time = end_time - metrics_rets = [ - as_numpy(metrics_tensor) - for metrics_tensor in metrics_tensors - ] - metrics.extend(metrics_rets) logging.info(metrics_format.format(*metrics)) batch_id += 1 except fluid.core.EOFException: diff --git a/models/multitask/mmoe/config.yaml b/models/multitask/mmoe/config.yaml index 0c79f9e6086c70b9c0d4b9cc26fc8bdfe76662fe..354bd218a9e63eeaa7657b2d77c94d9507a3e8bc 100644 --- a/models/multitask/mmoe/config.yaml +++ b/models/multitask/mmoe/config.yaml @@ -17,12 +17,12 @@ workspace: "models/multitask/mmoe" dataset: - name: dataset_train batch_size: 5 - type: QueueDataset + type: DataLoader # or QueueDataset data_path: "{workspace}/data/train" data_converter: "{workspace}/census_reader.py" - name: dataset_infer batch_size: 5 - type: QueueDataset + type: DataLoader # or QueueDataset data_path: "{workspace}/data/train" data_converter: "{workspace}/census_reader.py" @@ -48,7 +48,7 @@ runner: save_inference_interval: 4 save_checkpoint_path: "increment" save_inference_path: "inference" - print_interval: 10 + print_interval: 1 - name: infer_runner class: infer init_model_path: "increment/1"