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
64103fb6
Unverified
Commit
64103fb6
authored
Dec 28, 2020
by
Julien Plu
Committed by
GitHub
Dec 28, 2020
Browse files
Fix TransfoXL (#9302)
parent
d97d06d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py
src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py
+2
-2
No files found.
src/transformers/models/transfo_xl/modeling_tf_transfo_xl.py
View file @
64103fb6
...
@@ -501,8 +501,8 @@ class TFTransfoXLMainLayer(tf.keras.layers.Layer):
...
@@ -501,8 +501,8 @@ class TFTransfoXLMainLayer(tf.keras.layers.Layer):
# There are `mlen + qlen` steps that can be cached into mems
# There are `mlen + qlen` steps that can be cached into mems
new_mems
=
[]
new_mems
=
[]
end_idx
=
mlen
+
max
(
0
,
qlen
)
end_idx
=
mlen
+
tf
.
math
.
maximum
(
0
,
qlen
)
beg_idx
=
max
(
0
,
end_idx
-
self
.
mem_len
)
beg_idx
=
tf
.
math
.
maximum
(
0
,
end_idx
-
tf
.
convert_to_tensor
(
self
.
mem_len
)
)
for
i
in
range
(
len
(
hids
)):
for
i
in
range
(
len
(
hids
)):
cat
=
tf
.
concat
([
mems
[
i
],
hids
[
i
]],
axis
=
0
)
cat
=
tf
.
concat
([
mems
[
i
],
hids
[
i
]],
axis
=
0
)
...
...
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