-
Notifications
You must be signed in to change notification settings - Fork 5
WIP: Update outlines (and outlines prompts) and transformers versions #256
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8fd9eb6
Update outlines (and outlines prompts) and transformers versions
dmjoy c245e49
Update older ADM code wrt outlines update
dmjoy b2d925c
Add prototype VLLM inference engine
dmjoy 2f306f4
Fix rebase error with decisionflow prompts
dmjoy 4f85197
Preliminary work on regex based schemas
dmjoy fb7a6b6
switched from poetry to uv
bc9cd16
determinism fix
6ab5445
updated comment for is_llama
5a5c9f9
added pytest to pyproject.toml
5d8d6e5
added bert-score dependency
1e360ba
updated pyproject.toml format and setuptools find
0c56920
temporary fix for 0-100 ranges
9306d57
revert back to json schema
ad1f657
uv lock
978c102
moved monkey patches to __init__.py
56ac1eb
updated configs
d02f447
fixes for tests
0a4c113
updated integration test output files
8472fd1
addressed feedback
e9e5c87
Quickfix for old outlines_adm
dmjoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| from outlines.backends.outlines_core import OutlinesCoreBackend | ||
| from outlines.models.transformers import TransformerTokenizer | ||
| from outlines_core import Vocabulary | ||
|
|
||
|
|
||
| # monkey patch to fix https://github.com/dottxt-ai/outlines/pull/1831 | ||
| # fix was applied to outlines main, but we will probably be blocked from updating due to vllm dependency | ||
| # assuming this will be in official release >1.1.12 | ||
| @staticmethod | ||
| def deterministic_create_vocab(vocab, eos_token_id, eos_token, token_to_str): | ||
| formatted_vocab = {} | ||
| for token, token_id in vocab.items(): | ||
| token_as_str = token_to_str(token) | ||
| formatted_vocab.setdefault(token_as_str, []).append(token_id) | ||
| formatted_vocab.pop(eos_token) | ||
| return Vocabulary(eos_token_id, formatted_vocab) | ||
|
|
||
|
|
||
| OutlinesCoreBackend.create_outlines_core_vocabulary = deterministic_create_vocab | ||
|
|
||
|
|
||
| # monkey patch to fix https://github.com/dottxt-ai/outlines/pull/1817 | ||
| # newer verion of outlines fixes this issue (1.2.10), but we are blocked with the vllm dependency | ||
| def convert_token_to_string(self, token: str) -> str: | ||
| from transformers.file_utils import SPIECE_UNDERLINE | ||
|
|
||
| string = self.tokenizer.convert_tokens_to_string([token]) | ||
|
|
||
| if token.startswith(SPIECE_UNDERLINE) or token == "<0x20>": | ||
| return " " + string | ||
|
|
||
| return string | ||
|
|
||
|
|
||
| TransformerTokenizer.convert_token_to_string = convert_token_to_string | ||
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
|
dmjoy marked this conversation as resolved.
|
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.