"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "f87db5e412f561c089e70ab2b15bfa070c2b07f5"
Unverified Commit f53a5dec authored by Huazhong Ji's avatar Huazhong Ji Committed by GitHub
Browse files

remove unnecessary guard code related with pytorch versions 1.4.2 ~ 1.7.0 (#32210)

remove unnecessary guard code related with pytorch versions 1.4.2 ~
1.7.0
parent 5658e749
...@@ -64,12 +64,6 @@ if is_torch_available(): ...@@ -64,12 +64,6 @@ if is_torch_available():
from torch.optim.lr_scheduler import _LRScheduler as LRScheduler from torch.optim.lr_scheduler import _LRScheduler as LRScheduler
# this is used to suppress an undesired warning emitted by pytorch versions 1.4.2-1.7.0
try:
from torch.optim.lr_scheduler import SAVE_STATE_WARNING
except ImportError:
SAVE_STATE_WARNING = ""
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)
...@@ -251,10 +245,10 @@ def distributed_broadcast_scalars( ...@@ -251,10 +245,10 @@ def distributed_broadcast_scalars(
def reissue_pt_warnings(caught_warnings): def reissue_pt_warnings(caught_warnings):
# Reissue warnings that are not the SAVE_STATE_WARNING # Reissue warnings
if len(caught_warnings) > 1: if len(caught_warnings) > 1:
for w in caught_warnings: for w in caught_warnings:
if w.category is not UserWarning or w.message != SAVE_STATE_WARNING: if w.category is not UserWarning:
warnings.warn(w.message, w.category) warnings.warn(w.message, w.category)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment