From 56b8710dc44fa207309655d5080df9a4e0a0d6b5 Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Fri, 6 May 2022 08:46:41 +0000 Subject: [PATCH] fix: fix bug get paddle version --- ppcls/engine/engine.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ppcls/engine/engine.py b/ppcls/engine/engine.py index 460856e3..5b5c4da8 100644 --- a/ppcls/engine/engine.py +++ b/ppcls/engine/engine.py @@ -247,13 +247,10 @@ class Engine(object): self.config["AMP"]["use_fp16_test"] = True self.amp_eval = True - # TODO(gaotingquan): to compatible with Paddle 2.2, 2.3, develop and so on. - paddle_version = sum([ - int(x) * 10**(2 - i) - for i, x in enumerate(paddle.__version__.split(".")[:3]) - ]) + # TODO(gaotingquan): to compatible with different versions of Paddle + paddle_version = paddle.__version__[:3] # paddle version < 2.3.0 and not develop - if paddle_version < 230 and paddle_version != 0: + if paddle_version not in ["2.3", "0.0"]: if self.mode == "train": self.model, self.optimizer = paddle.amp.decorate( models=self.model, -- GitLab