This repository was archived by the owner on Mar 21, 2026. It is now read-only.
Closed
Conversation
|
this will change my life. if I can help with testing in any way let me know |
Author
|
I am still waiting for feedback from the team before I continue with the implementation. @Narsil @OlivierDehaene can you have a look and tell me what you think? |
This was referenced Dec 7, 2023
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What does this PR do?
This PR is meant for discussion purposes, around the idea to add custom logits processors, discussed here:
#1269
It is not fully implemented yet, but the interfaces are there, and the design discussion can be held.
The idea is, how can we add custom logits processing code, allowing individual generation requests to control them, without injecting new dependencies to the
text-generation-inferenceserver.Example use case:
The lm-format-enforcer library supports JSON Schema and Regex decoding using logits processing. Can we use the
text-generation-inferenceserver to decode different JSON schemas and regexes for different requests?This PR proposes the following solution:
NextTokenChooserParametersmessage will contain optionalLogitsProcessorParametersobjects, each containing the name of the processor, and a list of strings as its parameters (staying as generic as possible to make the grpc layer simple).This will allow external libraries to register logits processors, that will be used when requests that mention them are given.
Example flow:
--custom_modules=lmformatenforcer.integrations.text_generation_inferenceflag__init__.pycode callsCustomLogitsProcessorsManager.register_factory(JsonSchemaFactory)name=jsonschema, parameters=["<str of json schema>"]in the logits parametersNextTokenChooserconstructor finds the factory in the central repository, and creates a logits warper for decoding the specific JSON schema-infin the logits of the tokens that would violate the json schemaWhat do you think of this design? You can look at the branch comparison for most of the key ideas. Can I go ahead and continue the full implementation?
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.