forked from dottxt-ai/outlines
-
Notifications
You must be signed in to change notification settings - Fork 0
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
merge upstream #2
Open
francislabountyjr
wants to merge
297
commits into
serp-ai:main
Choose a base branch
from
dottxt-ai:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Make the code render as Python.
Signed-off-by: Sherlock113 <[email protected]>
Fixes #856 The code this PR removes introduces an artificial and erroneous loop transition in every final state that is always traversed, regardless of the generation. The comment doesn't make sense in my opinion, as the `if` above just handles exactly this case. Removing this piece of code fixes the bug that surfaced in the upgrade of outlines in the vLLM integration.
Fixes #823 This comment details the issues error: #823 (comment) The reproduction code provided results in a json schema with `OneOf[pets]`: ``` class Model(BaseModel): pet: Union[Cat, Dog] = Field(..., discriminator='pet_type') ``` Before this PR: `OneOf` uses negative lookaheads to assert that only one schema member is included. This is illegal in `interegular`, more details available here: #456 After `OneOf` uses or-joined non-capturing groups which don't have the same issues with `interegular`.
In the outlines docs, we have the example ```python import outlines def my_tool(arg1: str, arg2: int): """Tool description. The rest of the docstring """ pass @outlines.prompt def tool_prompt(question, tool): """{{ question }} COMMANDS 1. {{ tool | name }}: {{ tool | description }}, args: {{ tool | args }} {{ tool | source }} """ prompt = tool_prompt("Can you do something?", my_tool) print(prompt) ``` However, when I tried running this code, it did not work because the `args` filter used in `{{ tool | args }}` was not implemented. I implemented the `args` filter so now this example works. Now the args filter will output all of the arguments with the type annotations and default values (if they are provided). Example: ```python from typing import List def foo(x, y: str, z: List[int]=[1, 2, 3]): pass @outlines.prompt def tool_prompt(fn): """My args: {{ fn | args }}""" prompt = tool_prompt(foo) print(prompt) ``` which outputs ```python My args: x, y: str, z: List[int] = [1, 2, 3] ```
Hi, Thank you for this great library! It seems that the docstrings are not rendered correctly in the docs. I think we should explicitly set the `docstring_style` because [it defaults to `"google"`](https://mkdocstrings.github.io/python/usage/configuration/docstrings/#docstring_style) but outlines is using numpy. Before: ![Screenshot 2024-12-16 at 23 00 26](https://github.com/user-attachments/assets/c752ee3d-519e-4098-b943-3aab43c8af25) After: ![Screenshot 2024-12-16 at 23 00 41](https://github.com/user-attachments/assets/5b5f524b-6921-4dbe-994d-72c079e677bc) There seem to be other issues in the docstrings: - for example [`Properties`](https://github.com/dottxt-ai/outlines/blob/main/outlines/models/openai.py#L23) should be [`Attributes`](https://numpydoc.readthedocs.io/en/latest/format.html#parameters) - only openai and transformers models are present in the [api reference](https://github.com/dottxt-ai/outlines/blob/main/docs/api/models.md) I'm happy to make followup PRs for those. Please let me know if I missed something, I couldn't find related issues/PRs.
Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
the old library structure has not been updated to reflect the present one.
Before this commit, when you ran pytest -k specific_test, it spawned dozens of the same skipped warnings message on stdout... IMHO, that was not ideal ^^ Bug introduced in d32dfde
Allow giving custom filters to the prompt decorator ``` def reverses: str) -> str: return s[::-1] @prompt(filters={ 'reverse': reverse }) def reverse_prompt(text): '''{{ text | reverse }}''' prompt = reverse_prompt("Hello") print(prompt) >>> "olleH" ```
There's an extra `outlines.generate` row in the feature matrix docs. This removes it. I also modified the markdown syntax for one header to use ** rather than __, consistent with the rest of the table.
We have noticing the following error with a recent version of outlines when used with MLX: ``` TypeError: argument 'token_id': 'float' object cannot be interpreted as an integer At: /.../outlines_core/fsm/guide.py(294): get_next_state /.../outlines/processors/structured.py(101): process_logits /.../outlines/processors/base_logits_processor.py(90): __call__ ``` The issue is that the MLX array of tokens, which are integers, are being force-converted to floats, even though outlines expects an integer array. This is because all MLX arrays are being converted to `float32`, even when it's not necessarily appropriate, like in this case. Looking at the [commented link](https://ml-explore.github.io/mlx/build/html/usage/numpy.html#pytorch), the advice was to convert to `float32` only for `bfloat16`, because numpy does not support `bfloat16`. Now the MLX `_to_torch` implementation matches the other array libraries, none of the other libraries are being force-casted to float
The existing README has underwhelming or incorrect results (Example is underwhelming #1347) due to lack of templating for instruct models. This adds special tokens for each instruct model call, as well as provide comments on how to obtain/produce special tokens. --------- Co-authored-by: Victoria Terenina <[email protected]>
Also add instructions about different outlines "flavors"! Co-authored-by: Cameron Pfiffer <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.