Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests for XLA generation in TF #18298

Merged
merged 2 commits into from
Aug 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions tests/test_modeling_tf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,17 @@ def _generate_and_check_results(model, config, inputs_dict):
config.do_sample = False
config.num_beams = num_beams
config.num_return_sequences = num_return_sequences

# fix config for models with additional sequence-length limiting settings
for var_name in ["max_position_embeddings", "max_target_positions"]:
if hasattr(config, var_name):
try:
setattr(config, var_name, max_length)
except NotImplementedError:
# xlnet will raise an exception when trying to set
# max_position_embeddings.
pass

model = model_class(config)

if model.supports_xla_generation:
Expand Down Expand Up @@ -1713,15 +1724,6 @@ def test_xla_generate_slow(self):

Either the model supports XLA generation and passes the inner test, or it raises an appropriate exception
"""
# TODO (Joao): find the issues related to the following models. They are passing the fast test, but failing
# the slow one.
if any(
[
model in str(self).lower()
for model in ["tfbart", "tfblenderbot", "tfmarian", "tfmbart", "tfopt", "tfpegasus"]
]
):
return
num_beams = 8
num_return_sequences = 2
max_length = 128
Expand Down