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
96cc02b5
Unverified
Commit
96cc02b5
authored
Dec 02, 2021
by
yis11178
Committed by
GitHub
Dec 02, 2021
Browse files
change tf.math.divide with int(/) to remove dim_per_head from the TF graph (#14600)
Co-authored-by:
yis
<
yis@graphcore.ai
>
parent
43f953cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/models/distilbert/modeling_tf_distilbert.py
src/transformers/models/distilbert/modeling_tf_distilbert.py
+1
-1
No files found.
src/transformers/models/distilbert/modeling_tf_distilbert.py
View file @
96cc02b5
...
...
@@ -170,7 +170,7 @@ class TFMultiHeadSelfAttention(tf.keras.layers.Layer):
k_length
=
shape_list
(
key
)[
1
]
# assert dim == self.dim, f'Dimensions do not match: {dim} input vs {self.dim} configured'
# assert key.size() == value.size()
dim_per_head
=
tf
.
math
.
divide
(
self
.
dim
,
self
.
n_heads
)
dim_per_head
=
int
(
self
.
dim
/
self
.
n_heads
)
dim_per_head
=
tf
.
cast
(
dim_per_head
,
dtype
=
tf
.
int32
)
mask_reshape
=
[
bs
,
1
,
1
,
k_length
]
...
...
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