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

[Misc]: How to use guided decoding and regex as well? #5063

Open
debraj135 opened this issue May 27, 2024 · 4 comments
Open

[Misc]: How to use guided decoding and regex as well? #5063

debraj135 opened this issue May 27, 2024 · 4 comments
Labels

Comments

@debraj135
Copy link

Anything you want to discuss about vllm.

Here is my guided_json

guided_json = {"type": "object", "properties": { "age": {"type": "string", "pattern": r"^Fifty"}, "height": {"type": "string", "pattern": r"^five"}}}

I want to enforce the initial string in each of the keys, is this supported? And how can I go about doing this?

@debraj135 debraj135 added the misc label May 27, 2024
@AswanthManoj
Copy link

I also have the same question on how to use do contrained decoding with regex string as the input or maybe a pydantic object schema json

@clj55
Copy link

clj55 commented May 29, 2024

I have the same question too!

I tried doing this:
from outlines import models, generate
model = models.vllm(model="TheBloke/Mistral-7B-OpenOrca-AWQ", device=device, quantization="awq", dtype="half", tensor_parallel_size=2)
sampling_params = SamplingParams(temperature=0.0, top_p=0.95, max_tokens=300)
generator = generate.json(model, schema)
answer = generator(prompt, sampling_params = sampling_params)

But got the error "AttributeError: module 'outlines.models' has no attribute 'vllm'"

@debraj135
Copy link
Author

Does anyone have an answer to this?

@clj55
Copy link

clj55 commented Jun 5, 2024

When I give the JSON output in the example and add a line like "Only use the fields given in the example" in the prompt, the output is constrained to only the keys given in the example. I didn't the outlines library at all. Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants