提交 56b8710d 编写于 作者: G gaotingquan 提交者: Tingquan Gao

fix: fix bug get paddle version

上级 bd524e8a
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册