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
45dc04f3
Commit
45dc04f3
authored
Oct 08, 2019
by
thomwolf
Browse files
tf model [WIP]
parent
24831477
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
493 additions
and
18 deletions
+493
-18
transformers/modeling_ctrl.py
transformers/modeling_ctrl.py
+18
-18
transformers/modeling_tf_ctrl.py
transformers/modeling_tf_ctrl.py
+475
-0
No files found.
transformers/modeling_ctrl.py
View file @
45dc04f3
...
...
@@ -111,7 +111,7 @@ class MultiHeadAttention(torch.nn.Module):
v
=
self
.
split_into_heads
(
v
,
batch_size
)
if
layer_past
is
not
None
:
past_key
,
past_value
=
layer_past
[
0
],
layer_past
[
1
]
k
=
torch
.
cat
((
past_key
,
k
),
dim
=-
1
)
k
=
torch
.
cat
((
past_key
,
k
),
dim
=-
2
)
v
=
torch
.
cat
((
past_value
,
v
),
dim
=-
2
)
present
=
torch
.
stack
((
k
,
v
))
...
...
transformers/modeling_tf_ctrl.py
0 → 100644
View file @
45dc04f3
This diff is collapsed.
Click to expand it.
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