diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/create_programs.py b/paddle/fluid/train/custom_trainer/feed/scripts/create_programs.py index 396381ce99e6ca345650ca18ce03920d8ba38de1..e1fad3941b87ed29092b2c475786ad53df762e9f 100644 --- a/paddle/fluid/train/custom_trainer/feed/scripts/create_programs.py +++ b/paddle/fluid/train/custom_trainer/feed/scripts/create_programs.py @@ -95,8 +95,14 @@ class ModelBuilder: main_program = fluid.Program() startup_program = fluid.Program() with fluid.program_guard(main_program, startup_program): - #TODO return dict maybe better ? - input_accessor, sparses, inputs, outputs, monitors = self._inference() + #input_accessor, sparses, inputs, outputs, monitors + inference_info = self._inference() + inputs = inference_info['inputs'] + outputs = inference_info['outputs'] + sparses = inference_info['sparses'] + monitors = inference_info['monitors'] + input_accessor = inference_info['accessors'] + test_program = main_program.clone(for_test=True) loss, labels = self._loss_function(*outputs) @@ -149,7 +155,7 @@ class ModelBuilder: 'loss': loss.name, 'input_accessor': input_accessor, 'monitor': monitors, - 'aa_Attention' : 'Do Not Modify This File Manually, Unless You Really Know It' + 'aa_Attention': 'Do Not Modify This File Manually, Unless You Really Know It' } with open(model_desc_path, 'w') as f: diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/example.py b/paddle/fluid/train/custom_trainer/feed/scripts/example.py index c06b53b37fbf960f240571eac5c49886e900c9f8..54e1128f2e0597d3f57e0e1b856d2efc27f0b709 100644 --- a/paddle/fluid/train/custom_trainer/feed/scripts/example.py +++ b/paddle/fluid/train/custom_trainer/feed/scripts/example.py @@ -32,7 +32,7 @@ def inference(): net = fluid.layers.fc(net, 128, act='relu', name='fc_7') ctr_output = fluid.layers.fc(net, 1, act='sigmoid', name='ctr') - return [], [], [cvm_input], [ctr_output], monitors + return {'accessors': [], 'monitors': [], 'sparses': [], 'inputs': [cvm_input], 'outputs': [ctr_output]} def loss_function(ctr_output): """ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/join.py b/paddle/fluid/train/custom_trainer/feed/scripts/join.py index 1df4cf291b73409006fda862a5b0cd88be081a05..d3aeceb45062364745f3d316a35db3829f3f9efe 100644 --- a/paddle/fluid/train/custom_trainer/feed/scripts/join.py +++ b/paddle/fluid/train/custom_trainer/feed/scripts/join.py @@ -50,7 +50,7 @@ def inference(): { "name": "epoch_auc", "class": "AucMonitor", "target": ctr_output, "compute_interval": 600 }, { "name": "day_auc", "class": "AucMonitor", "target": ctr_output, "compute_interval": 86400 } ] - return accessors, [sparse_cvm], [cvm_input], [ctr_output], monitors + return {'accessors': accessors, 'monitors': monitors, 'sparses': [sparse_cvm], 'inputs': [cvm_input], 'outputs': [ctr_output]} def loss_function(ctr_output): """ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/main_program b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/main_program index 201006fe19658ec040ba7caeadc0a21a74743431..dd455fb1e9d6d8d46f8782b7813b82a3e7c2badc 100644 Binary files a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/main_program and b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/main_program differ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/model.yaml b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/model.yaml index 7b19ac93e8355d6825e2eab81314a597b54d6054..e13df08563cbda5bf25d5ad430c430ae3418f6f5 100644 --- a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/model.yaml +++ b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/model.yaml @@ -100,8 +100,7 @@ labels: shape: [-1, 1] loss: loss_ctr monitor: -- {class: AucMonitor, compute_interval: 3600, name: epoch_auc, target: ctr.tmp_2, - target_idx: 0} +- {class: AucMonitor, compute_interval: 600, name: epoch_auc, target: ctr.tmp_2, target_idx: 0} - {class: AucMonitor, compute_interval: 86400, name: day_auc, target: ctr.tmp_2, target_idx: 0} outputs: - name: ctr.tmp_2 diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/startup_program b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/startup_program index 7109a2d4fd5c550d062d5e34d3cd0af84b2c39cf..3f0c50e77b41889f790d9c8001e43b7b275fc152 100644 Binary files a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/startup_program and b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/startup_program differ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/test_program b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/test_program index 51a84cf072d40d44de5e1bb2ae7624e853b2d251..6860dda25a06b7aadfdb4ceb97572ec21e9f19b3 100644 Binary files a/paddle/fluid/train/custom_trainer/feed/scripts/model/join/test_program and b/paddle/fluid/train/custom_trainer/feed/scripts/model/join/test_program differ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/main_program b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/main_program index 42e13b415b99886634974a26c91644f7c604e2a4..f2061d99b8103af8aa0a4b748e12b6e14c4a4f71 100644 Binary files a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/main_program and b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/main_program differ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/model.yaml b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/model.yaml index a599d5f9f04c5e76622edfa5a33c30455184ca5b..4a06938b9280f6571e5a745d7e963ef5f314e596 100644 --- a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/model.yaml +++ b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/model.yaml @@ -81,8 +81,7 @@ labels: shape: [-1, 1] loss: loss_ctr monitor: -- {class: AucMonitor, compute_interval: 3600, name: epoch_auc, target: ctr.tmp_2, - target_idx: 0} +- {class: AucMonitor, compute_interval: 600, name: epoch_auc, target: ctr.tmp_2, target_idx: 0} - {class: AucMonitor, compute_interval: 86400, name: day_auc, target: ctr.tmp_2, target_idx: 0} outputs: - name: ctr.tmp_2 diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/startup_program b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/startup_program index 2b010666efdbb4bfd997eb8ae32963bdcfc31f07..5a47d80a18c8a96074fab78e553dc6a1e212230f 100644 Binary files a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/startup_program and b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/startup_program differ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/test_program b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/test_program index 971e83f091ccc7a11aeacf9d2744ce36dd6ec31b..9904b7d2a5a61ecda34d2c8e10342483ff961ba3 100644 Binary files a/paddle/fluid/train/custom_trainer/feed/scripts/model/update/test_program and b/paddle/fluid/train/custom_trainer/feed/scripts/model/update/test_program differ diff --git a/paddle/fluid/train/custom_trainer/feed/scripts/update.py b/paddle/fluid/train/custom_trainer/feed/scripts/update.py index 35aacda006c17bac143a6e5d3f69e1b83bf3bdcf..ec77ba16e86b6055c314653afdac3eec595c88f7 100644 --- a/paddle/fluid/train/custom_trainer/feed/scripts/update.py +++ b/paddle/fluid/train/custom_trainer/feed/scripts/update.py @@ -43,7 +43,7 @@ def inference(): { "name": "day_auc", "class": "AucMonitor", "target": ctr_output, "compute_interval": 86400 } ] - return accessors, [sparse_cvm], [cvm_input], [ctr_output], monitors + return {'accessors': accessors, 'monitors': monitors, 'sparses': [sparse_cvm], 'inputs': [cvm_input], 'outputs': [ctr_output]} def loss_function(ctr_output): """