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

[Frontend] Add logits_processors as an extra completion argument #11150

Merged
merged 6 commits into from
Dec 14, 2024

Conversation

bradhilton
Copy link
Contributor

@bradhilton bradhilton commented Dec 12, 2024

Adds logits_processors as an extra (optional) argument to ChatCompletionRequest and CompletionRequest:

    logits_processors: Optional[List[Union[str, LogitsProcessorConstructor]]] = Field(
        default=None,
        description=(
            "A list of either qualified names of logits processors, or "
            "constructor objects, to apply when sampling. A constructor is "
            "a JSON object with a required 'qualname' field specifying the "
            "qualified name of the processor class/factory, and optional "
            "'args' and 'kwargs' fields containing positional and keyword "
            "arguments. For example: {'qualname': 'my_module.MyLogitsProcessor',"
            "'args': [1, 2], 'kwargs': {'param': 'value'}}."))

This enables passing built-in or custom logits processors to direct the sampling process.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added the frontend label Dec 12, 2024
@bradhilton bradhilton marked this pull request as draft December 12, 2024 22:26
@bradhilton bradhilton marked this pull request as ready for review December 12, 2024 22:50
@DarkLight1337
Copy link
Member

DarkLight1337 commented Dec 13, 2024

Hmm, this seems a bit dangerous as it allows the client to execute any Python module server-side. A better solution would be to introduce a registry of logits processors which the client can reference by their key in the registry.

@bradhilton
Copy link
Contributor Author

bradhilton commented Dec 13, 2024

Hmm, this seems a bit dangerous as it allows the client to execute any Python module server-side. A better solution would be to introduce a registry of logits processors which the client can reference by their key in the registry.

Great feedback, thank you @DarkLight1337. I added an optional --logits-processor-pattern engine argument for whitelisting matching processor qualified names. It's None by default, disallowing the usage of the logits_processors argument entirely.

Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a pattern to restrict access also works, thanks for adding this!

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) December 14, 2024 02:17
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 14, 2024
@bradhilton
Copy link
Contributor Author

@DarkLight1337 buildkite/ci/pr/multi-step-tests-4-gpus failed due to a connect timeout. Is this normal test flakiness or cause for concern?

@DarkLight1337
Copy link
Member

Let me retry the test.

@DarkLight1337 DarkLight1337 merged commit 9c3dadd into vllm-project:main Dec 14, 2024
68 checks passed
@bradhilton
Copy link
Contributor Author

Thanks @DarkLight1337 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants