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
993a187c
Unverified
Commit
993a187c
authored
Nov 23, 2022
by
fxmarty
Committed by
GitHub
Nov 23, 2022
Browse files
fix device in longformer onnx path (#20419)
parent
bc00c29d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
src/transformers/models/led/modeling_led.py
src/transformers/models/led/modeling_led.py
+1
-1
src/transformers/models/longformer/modeling_longformer.py
src/transformers/models/longformer/modeling_longformer.py
+1
-1
No files found.
src/transformers/models/led/modeling_led.py
View file @
993a187c
...
@@ -425,7 +425,7 @@ class LEDEncoderSelfAttention(nn.Module):
...
@@ -425,7 +425,7 @@ class LEDEncoderSelfAttention(nn.Module):
hidden_states
.
size
(
2
),
hidden_states
.
size
(
2
),
]
]
overlapping_chunks
=
torch
.
empty
(
chunk_size
)
overlapping_chunks
=
torch
.
empty
(
chunk_size
,
device
=
hidden_states
.
device
)
for
chunk
in
range
(
chunk_size
[
1
]):
for
chunk
in
range
(
chunk_size
[
1
]):
overlapping_chunks
[:,
chunk
,
:,
:]
=
hidden_states
[
overlapping_chunks
[:,
chunk
,
:,
:]
=
hidden_states
[
:,
chunk
*
window_overlap
:
chunk
*
window_overlap
+
2
*
window_overlap
,
:
:,
chunk
*
window_overlap
:
chunk
*
window_overlap
+
2
*
window_overlap
,
:
...
...
src/transformers/models/longformer/modeling_longformer.py
View file @
993a187c
...
@@ -796,7 +796,7 @@ class LongformerSelfAttention(nn.Module):
...
@@ -796,7 +796,7 @@ class LongformerSelfAttention(nn.Module):
hidden_states
.
size
(
2
),
hidden_states
.
size
(
2
),
]
]
overlapping_chunks
=
torch
.
empty
(
chunk_size
)
overlapping_chunks
=
torch
.
empty
(
chunk_size
,
device
=
hidden_states
.
device
)
for
chunk
in
range
(
chunk_size
[
1
]):
for
chunk
in
range
(
chunk_size
[
1
]):
overlapping_chunks
[:,
chunk
,
:,
:]
=
hidden_states
[
overlapping_chunks
[:,
chunk
,
:,
:]
=
hidden_states
[
:,
chunk
*
window_overlap
:
chunk
*
window_overlap
+
2
*
window_overlap
,
:
:,
chunk
*
window_overlap
:
chunk
*
window_overlap
+
2
*
window_overlap
,
:
...
...
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