Swap the order of ema and to_static

pull/3349/head
drryanhuang 2025-02-18 09:27:35 +00:00
parent b76c7ec696
commit 018912cab4
1 changed files with 3 additions and 2 deletions

View File

@ -236,8 +236,6 @@ class Engine(object):
# build model
self.model = build_model(self.config, self.mode)
# set @to_static for benchmark, skip this by default.
apply_to_static(self.config, self.model, is_rec=self.is_rec)
# load_pretrain
if self.config["Global"]["pretrained_model"] is not None:
@ -260,6 +258,9 @@ class Engine(object):
self.model_ema = ExponentialMovingAverage(
self.model, self.config['EMA'].get("decay", 0.9999))
# set @to_static for benchmark, skip this by default.
apply_to_static(self.config, self.model, is_rec=self.is_rec)
# check the gpu num
world_size = dist.get_world_size()
self.config["Global"]["distributed"] = world_size != 1