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

merge upstream #2

Open
wants to merge 288 commits into
base: main
Choose a base branch
from
Open

merge upstream #2

wants to merge 288 commits into from

Conversation

francislabountyjr
Copy link
Member

No description provided.

rlouf and others added 30 commits December 9, 2024 16:02
The `enum` keyword is reserved for arrays of constants. When we have
callables as members of a Python `Enum`, we get an object whose
properties are the arguments of the callable. The `Enum` thus needs
to be converted into a `oneOf` field.
The current link points to a HTML instead of a PNG, so after it's downloaded via requests.get, PIL isn't able to recognize the format and rightly so.
This PR addresses #1335 
I have kept the `SamplingParameters` in `outlines/generate/api.py` cause
its imported at many places and may break examples ig.
Would you want to change that @dgerlanc ??
Otherwise if this looks good, I can make docs changes if needd, lmk.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.