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
14e9d295
Unverified
Commit
14e9d295
authored
Aug 16, 2021
by
sararb
Committed by
GitHub
Aug 16, 2021
Browse files
compute seq_len from inputs_embeds (#13128)
parent
e2f07c01
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/models/electra/modeling_electra.py
src/transformers/models/electra/modeling_electra.py
+1
-1
No files found.
src/transformers/models/electra/modeling_electra.py
View file @
14e9d295
...
@@ -854,12 +854,12 @@ class ElectraModel(ElectraPreTrainedModel):
...
@@ -854,12 +854,12 @@ class ElectraModel(ElectraPreTrainedModel):
raise
ValueError
(
"You cannot specify both input_ids and inputs_embeds at the same time"
)
raise
ValueError
(
"You cannot specify both input_ids and inputs_embeds at the same time"
)
elif
input_ids
is
not
None
:
elif
input_ids
is
not
None
:
input_shape
=
input_ids
.
size
()
input_shape
=
input_ids
.
size
()
batch_size
,
seq_length
=
input_shape
elif
inputs_embeds
is
not
None
:
elif
inputs_embeds
is
not
None
:
input_shape
=
inputs_embeds
.
size
()[:
-
1
]
input_shape
=
inputs_embeds
.
size
()[:
-
1
]
else
:
else
:
raise
ValueError
(
"You have to specify either input_ids or inputs_embeds"
)
raise
ValueError
(
"You have to specify either input_ids or inputs_embeds"
)
batch_size
,
seq_length
=
input_shape
device
=
input_ids
.
device
if
input_ids
is
not
None
else
inputs_embeds
.
device
device
=
input_ids
.
device
if
input_ids
is
not
None
else
inputs_embeds
.
device
if
attention_mask
is
None
:
if
attention_mask
is
None
:
...
...
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