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

Use Faster FSM #1175

Merged
merged 1 commit into from
Sep 28, 2024
Merged

Use Faster FSM #1175

merged 1 commit into from
Sep 28, 2024

Conversation

lapp0
Copy link
Contributor

@lapp0 lapp0 commented Sep 26, 2024

No description provided.

@lapp0 lapp0 changed the title Performant FSM Implementation Use Faster FSM Sep 26, 2024
"""Guide to generate text in the language of a regular expression."""

initial_state = 0
class RegexGuide(CoreRegexGuide):
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to keep the RegexGuide here?

Copy link
Contributor Author

@lapp0 lapp0 Sep 27, 2024

Choose a reason for hiding this comment

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

This is the cached implementation of RegexGuide. Only __init__.py is changed to enable caching.

Comment on lines 210 to 227
def test_vllm_json_schema(model):
prompt = "Output some JSON. "

schema = """{
"title": "spam",
"type": "object",
"properties": {
"foo" : {"type": "boolean"},
"bar": {"type": "string", "maxLength": 4}
},
"required": ["foo", "bar"]
}
"""

sampling_params = SamplingParams(temperature=0)
result = generate.json(model, schema, whitespace_pattern="")(
prompt, max_tokens=100, seed=10, sampling_params=sampling_params
)
Copy link
Member

@rlouf rlouf Sep 27, 2024

Choose a reason for hiding this comment

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

Why are we removing the vLLM integration tests in this PR? It should at least be a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a mistake, reverted.

@lapp0 lapp0 force-pushed the performant-fsm branch 2 times, most recently from 7873cfc to 857b902 Compare September 27, 2024 23:29
@rlouf
Copy link
Member

rlouf commented Sep 28, 2024

LGTM!

@rlouf rlouf merged commit 30531e5 into dottxt-ai:main Sep 28, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants