Use LogitsProcessor
for transformers
integration
#926
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #806
Related: #789
Requesting comment on whether we should unify the logits processor in this PR as described in the last section of this message. @brandonwillard @rlouf
Problem
transformers
has two issues in itsgenerate
integration:input_ids
is empty, it failsSolution
Implement logits processors for transformers.
Proposed Additional Work
We have four implementations of logits processors which do the same thing. Their implementations have drifted and now there are growing differences in their implementation details. We should simplify this and use a single logits processor for all models, ensuring a bug fix or enhancement for one logits processor applies to all models.
mlx
library integration (viamlx-lm
) #918 minimalGuide
integration will be buggy whenlen(tokens) > 1
in aWrite
instruction #855This WIP PR shows generalized
logits_processors.py
which aims to be compatible with all inference engines, along with a modifiedgenerate/regex.py
incorporating the new singular logits processor implementation.