Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ydshieh committed Jan 29, 2025
1 parent ec7afad commit 064c51b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,9 @@ def test_assisted_decoding_matches_greedy_search(self, assistant_type):
"return_dict_in_generate": True,
"use_cache": True,
}
output_greedy = model.generate(**generation_kwargs, **inputs_dict)
logits_processor_kwargs = self._get_logits_processor_kwargs(config=model.config)

output_greedy = model.generate(**generation_kwargs, **inputs_dict, **logits_processor_kwargs)

# test with the same assistant model or randomly init one
# in the first case all candidate tokens are accepted, in the second none is accepted
Expand All @@ -1197,7 +1199,7 @@ def test_assisted_decoding_matches_greedy_search(self, assistant_type):
assistant_model.generation_config.num_assistant_tokens = 2 # see b)
assistant_model.generation_config.num_assistant_tokens_schedule = "constant" # see b)
generation_kwargs.update({"assistant_model": assistant_model})
output_assisted = model.generate(**generation_kwargs, **inputs_dict)
output_assisted = model.generate(**generation_kwargs, **inputs_dict, **logits_processor_kwargs)

# The two outputs must match and their shape must be as expected
self._check_similar_generate_outputs(output_greedy, output_assisted)
Expand Down

0 comments on commit 064c51b

Please sign in to comment.