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
bdb391e9
Unverified
Commit
bdb391e9
authored
Oct 13, 2023
by
Matt
Committed by
GitHub
Oct 13, 2023
Browse files
Fix Falcon generation test (#26770)
parent
c9785d95
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
2 deletions
+0
-2
tests/models/falcon/test_modeling_falcon.py
tests/models/falcon/test_modeling_falcon.py
+0
-2
No files found.
tests/models/falcon/test_modeling_falcon.py
View file @
bdb391e9
...
...
@@ -521,13 +521,11 @@ class FalconLanguageGenerationTest(unittest.TestCase):
test_text
=
"A sequence: 1, 2"
# should generate the rest of the sequence
unpadded_inputs
=
tokenizer
([
test_text
],
return_tensors
=
"pt"
).
to
(
"cuda:0"
)
unpadded_inputs
.
pop
(
"token_type_ids"
)
unpadded_gen_out
=
model
.
generate
(
**
unpadded_inputs
,
max_new_tokens
=
20
)
unpadded_gen_text
=
tokenizer
.
batch_decode
(
unpadded_gen_out
,
skip_special_tokens
=
True
)
dummy_text
=
"This is a longer text "
*
2
# forces left-padding on `test_text`
padded_inputs
=
tokenizer
([
test_text
,
dummy_text
],
return_tensors
=
"pt"
,
padding
=
True
).
to
(
"cuda:0"
)
padded_inputs
.
pop
(
"token_type_ids"
)
padded_gen_out
=
model
.
generate
(
**
padded_inputs
,
max_new_tokens
=
20
)
padded_gen_text
=
tokenizer
.
batch_decode
(
padded_gen_out
,
skip_special_tokens
=
True
)
...
...
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