@@ -996,11 +996,6 @@ def _run_from_dataset(self,
996
996
997
997
dataset ._prepare_to_run ()
998
998
999
- if fetch_handler is not None :
1000
- fetch_instance = fetch_handler
1001
- else :
1002
- fetch_instance = FetchHandler ([])
1003
-
1004
999
scope , trainer = self ._prepare_trainer (
1005
1000
program = program ,
1006
1001
dataset = dataset ,
@@ -1015,17 +1010,26 @@ def _run_from_dataset(self,
1015
1010
trainer ._gen_trainer_desc ()
1016
1011
1017
1012
self ._dump_debug_info (program = program , trainer = trainer )
1013
+ dataset ._dynamic_adjust_before_train (trainer .proto_desc .thread_num )
1018
1014
1019
1015
trainer_instance = self ._default_executor .init_for_dataset (
1020
1016
program .desc , trainer ._desc (), scope , dataset .dataset )
1021
1017
1022
- scope0 = trainer_instance .get_worker_scope (0 )
1018
+ if fetch_handler is not None :
1019
+ scope0 = trainer_instance .get_worker_scope (0 )
1020
+ fetch_monitor = FetchHandlerMonitor (scope0 , fetch_handler )
1021
+ fetch_monitor .start ()
1022
+
1023
+ self ._default_executor .run_from_dataset (trainer_instance )
1023
1024
1024
- fetch_monitor = FetchHandlerMonitor (scope0 , fetch_instance )
1025
- fetch_monitor .start ()
1026
- self ._default_executor .run_from_dataset (trainer_instance )
1027
- fetch_monitor .stop ()
1025
+ fetch_monitor .stop ()
1026
+ else :
1027
+
1028
+ self ._default_executor .run_from_dataset (trainer_instance )
1029
+
1030
+ dataset ._dynamic_adjust_after_train ()
1028
1031
dataset ._finish_to_run ()
1032
+
1029
1033
return None
1030
1034
1031
1035
def infer_from_dataset (self ,
0 commit comments