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
89087597
Unverified
Commit
89087597
authored
Apr 13, 2023
by
Joel Lamy-Poirier
Committed by
GitHub
Apr 13, 2023
Browse files
Indexing fix for gpt_bigcode (#22737)
Fix indexing
parent
7ade6ef7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
+2
-2
No files found.
src/transformers/models/gpt_bigcode/modeling_gpt_bigcode.py
View file @
89087597
...
...
@@ -538,7 +538,7 @@ class GPTBigCodeModel(GPTBigCodePreTrainedModel):
def
forward
(
self
,
input_ids
:
Optional
[
torch
.
Tensor
]
=
None
,
past_key_values
:
Optional
[
Union
[
List
[
torch
.
Tensor
]
,
int
]
]
=
None
,
past_key_values
:
Optional
[
List
[
torch
.
Tensor
]]
=
None
,
attention_mask
:
Optional
[
torch
.
Tensor
]
=
None
,
token_type_ids
:
Optional
[
torch
.
Tensor
]
=
None
,
position_ids
:
Optional
[
torch
.
Tensor
]
=
None
,
...
...
@@ -584,7 +584,7 @@ class GPTBigCodeModel(GPTBigCodePreTrainedModel):
past_length
=
0
past_key_values
=
tuple
([
None
]
*
len
(
self
.
h
))
else
:
past_length
=
past_key_values
[
0
]
[
0
]
.
size
(
-
2
)
past_length
=
past_key_values
[
0
].
size
(
-
2
)
if
attention_mask
is
not
None
and
len
(
attention_mask
.
shape
)
==
2
and
position_ids
is
None
:
# create position_ids on the fly for batch generation
...
...
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