Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
d1ad4bff
"sims/mem/vscode:/vscode.git/clone" did not exist on "d5b0e45bc51317fff3778f548d1aefcd93ee916f"
Unverified
Commit
d1ad4bff
authored
Nov 02, 2020
by
Sylvain Gugger
Committed by
GitHub
Nov 02, 2020
Browse files
Fix bad import with PyTorch <= 1.4.1 (#8237)
parent
3c8d401c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
src/transformers/trainer_pt_utils.py
src/transformers/trainer_pt_utils.py
+6
-1
No files found.
src/transformers/trainer_pt_utils.py
View file @
d1ad4bff
...
...
@@ -23,7 +23,7 @@ from typing import List, Optional, Union
import
numpy
as
np
import
torch
from
torch.optim.lr_scheduler
import
SAVE_STATE_WARNING
from
packaging
import
version
from
torch.utils.data.distributed
import
DistributedSampler
from
torch.utils.data.sampler
import
RandomSampler
,
Sampler
...
...
@@ -34,6 +34,11 @@ from .utils import logging
if
is_torch_tpu_available
():
import
torch_xla.core.xla_model
as
xm
if
version
.
parse
(
torch
.
__version__
)
<=
version
.
parse
(
"1.4.1"
):
SAVE_STATE_WARNING
=
""
else
:
from
torch.optim.lr_scheduler
import
SAVE_STATE_WARNING
logger
=
logging
.
get_logger
(
__name__
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment