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
b25f7802
"...git@developer.sourcefind.cn:modelzoo/solov2-pytorch.git" did not exist on "f0cb1d123f22183b0a52c2b4da4a55fa97f170ac"
Unverified
Commit
b25f7802
authored
Jul 09, 2020
by
Lysandre Debut
Committed by
GitHub
Jul 09, 2020
Browse files
Should check that torch TPU is available (#5636)
parent
3cc23eee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+2
-1
No files found.
src/transformers/modeling_utils.py
View file @
b25f7802
...
@@ -34,6 +34,7 @@ from .file_utils import (
...
@@ -34,6 +34,7 @@ from .file_utils import (
cached_path
,
cached_path
,
hf_bucket_url
,
hf_bucket_url
,
is_remote_url
,
is_remote_url
,
is_torch_tpu_available
,
)
)
from
.generation_utils
import
GenerationMixin
from
.generation_utils
import
GenerationMixin
...
@@ -794,7 +795,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin):
...
@@ -794,7 +795,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin):
}
}
return
model
,
loading_info
return
model
,
loading_info
if
hasattr
(
config
,
"xla_device"
)
and
config
.
xla_device
:
if
hasattr
(
config
,
"xla_device"
)
and
config
.
xla_device
and
is_torch_tpu_available
()
:
import
torch_xla.core.xla_model
as
xm
import
torch_xla.core.xla_model
as
xm
model
=
xm
.
send_cpu_data_to_device
(
model
,
xm
.
xla_device
())
model
=
xm
.
send_cpu_data_to_device
(
model
,
xm
.
xla_device
())
...
...
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