From 9f66366c0ae13f4b226736540a51d48e53f98498 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Mon, 7 Dec 2020 18:42:00 -0800 Subject: [PATCH] [training] SAVE_STATE_WARNING was removed in pytorch FYI `SAVE_STATE_WARNING` has been removed 3 days ago: pytorch/pytorch#46813 Fixes: #8232 @sgugger --- src/transformers/trainer_pt_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transformers/trainer_pt_utils.py b/src/transformers/trainer_pt_utils.py index cb3d4a5bfe5b7b..2ca37180a70a4d 100644 --- a/src/transformers/trainer_pt_utils.py +++ b/src/transformers/trainer_pt_utils.py @@ -34,7 +34,8 @@ if is_torch_tpu_available(): import torch_xla.core.xla_model as xm -if version.parse(torch.__version__) <= version.parse("1.4.1"): +# this is used to supress an undesired warning emitted by pytorch versions 1.4.2-1.7.0 +if version.parse(torch.__version__) <= version.parse("1.4.1") or version.parse(torch.__version__) > version.parse("1.7.0"): SAVE_STATE_WARNING = "" else: from torch.optim.lr_scheduler import SAVE_STATE_WARNING