From 97cc5f45146ffccd197e6be4250384a715f63ca0 Mon Sep 17 00:00:00 2001 From: malin10 Date: Tue, 2 Jun 2020 14:14:20 +0800 Subject: [PATCH] bug fix --- core/trainers/single_trainer.py | 3 +++ models/recall/fasttext/config.yaml | 1 + 2 files changed, 4 insertions(+) diff --git a/core/trainers/single_trainer.py b/core/trainers/single_trainer.py index 3c11730b..2f8fda74 100755 --- a/core/trainers/single_trainer.py +++ b/core/trainers/single_trainer.py @@ -253,6 +253,9 @@ class SingleTrainer(TranspileTrainer): _build_strategy = fluid.BuildStrategy() _exe_strategy = fluid.ExecutionStrategy() + # 0: kCoeffNumDevice; 1: One; 2: Customized + _build_strategy.gradient_scale_strategy = model_dict.get( + "gradient_scale_strategy", 0) if "thread_num" in model_dict and model_dict["thread_num"] > 1: _build_strategy.reduce_strategy = fluid.BuildStrategy.ReduceStrategy.Reduce _exe_strategy.num_threads = model_dict["thread_num"] diff --git a/models/recall/fasttext/config.yaml b/models/recall/fasttext/config.yaml index 9203fa7a..e0eb0847 100755 --- a/models/recall/fasttext/config.yaml +++ b/models/recall/fasttext/config.yaml @@ -77,6 +77,7 @@ phase: model: "{workspace}/model.py" # user-defined model dataset_name: dataset_train # select dataset by name thread_num: 1 + gradient_scale_strategy: 1 #- name: phase2 # model: "{workspace}/model.py" # user-defined model # dataset_name: dataset_infer # select dataset by name -- GitLab