Conversation
|
|
||
| prompts = self._extract_prompts(args, kwargs) | ||
| max_num_tokens = max(len(self.tokenizer.encode(p)) for p in prompts) | ||
|
|
There was a problem hiding this comment.
| sequence_length *= 2 | ||
| if sequence_length >= max_sequence_length: | ||
| sequence_length = max_sequence_length | ||
| kwargs["max_sequence_length"] = sequence_length |
There was a problem hiding this comment.
Bug: Assumes max_sequence_length has a default
default_max_sequence_length is read from inspect.signature(...).parameters["max_sequence_length"].default. If that default is inspect._empty (or the user passes max_sequence_length=None), comparisons like sequence_length >= max_sequence_length can raise TypeError, causing runtime failures on pipelines with a required max_sequence_length.
| """Disable prompt pruning by unwrapping the pipe.""" | ||
| if self.pipe_call: | ||
| self.pipe.__call__ = self.pipe_call | ||
|
|
There was a problem hiding this comment.
Bug: Helper disable may crash before enable
disable accesses self.pipe_call without initializing it in __init__. If disable is called before enable/wrap_pipe runs (or after partial initialization failures), this can raise AttributeError and prevent cleanup/saving flows that call .disable() on helpers.
|
This PR has been inactive for 10 days and is now marked as stale. |
|
This PR has been inactive for 10 days and is now marked as stale. |
|
|
||
| class PaddingPruningHelper: | ||
| """ | ||
| Helper for Prompt Pruning. |
There was a problem hiding this comment.
Typo, I guess it should be "Helper for Padding Pruning."
|
This PR has been inactive for 10 days and is now marked as stale. |
ab7febd to
d3d18ec
Compare
begumcig
left a comment
There was a problem hiding this comment.
Thank you so much Minette looks super good to me!
Co-authored-by: Nils Fleischmann <nils.fleischmann@outlook.com>
Description
I added
padding_pruningalgorithm andflux_tiny_random_with_tokenizerto fixtures to be able to testpadded_pruningpadding_pruningalgorithm insrc/pruna/algorithms/padding_pruning.pypadding_pruningalgorithm intests/algorithms/testers/padding_pruning.pyflux_tiny_random_with_tokenizeradded intests/fixtures.pyso thatpadding_pruningalgorithm can be tested.Type of Change
How Has This Been Tested?
Yes, by tests for
padding_pruning.Checklist