Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
24273268
Unverified
Commit
24273268
authored
Feb 13, 2023
by
Joao Gante
Committed by
GitHub
Feb 13, 2023
Browse files
Generate: Fix flaky indexing error in `test_constrained_beam_search_generate_dict_output` (#21561)
parent
93ed89bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
11 deletions
+2
-11
tests/generation/test_utils.py
tests/generation/test_utils.py
+2
-7
tests/models/whisper/test_modeling_whisper.py
tests/models/whisper/test_modeling_whisper.py
+0
-4
No files found.
tests/generation/test_utils.py
View file @
24273268
...
...
@@ -1359,13 +1359,8 @@ class GenerationTesterMixin:
)
# Sample constraints
if
not
input_ids
.
dtype
==
torch
.
float32
:
min_id
=
torch
.
min
(
input_ids
)
+
3
max_id
=
torch
.
max
(
input_ids
)
else
:
# otherwise this throws an error for Speech2TextModel since its inputs are floating points
min_id
=
3
max_id
=
100
min_id
=
3
max_id
=
model
.
config
.
vocab_size
force_tokens
=
torch
.
randint
(
min_id
,
max_id
,
(
1
,
2
)).
tolist
()[
0
]
constraints
=
[
PhrasalConstraint
(
force_tokens
),
...
...
tests/models/whisper/test_modeling_whisper.py
View file @
24273268
...
...
@@ -632,10 +632,6 @@ class WhisperModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCas
def
test_generate_without_input_ids
(
self
):
pass
@
unittest
.
skip
(
"Skip while we investigate while it's failing."
)
def
test_constrained_beam_search_generate_dict_output
(
self
):
pass
@
staticmethod
def
_get_encoder_outputs
(
model
,
input_ids
,
attention_mask
,
output_attentions
=
None
,
output_hidden_states
=
None
,
num_interleave
=
1
...
...
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