Skip to content

Add support for KerasNLP library #616

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 2 commits into from
Apr 11, 2024
Merged

Add support for KerasNLP library #616

merged 2 commits into from
Apr 11, 2024

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Apr 10, 2024

Following recent work to integrate KerasNLP library with the Hub, let's add it in our libraries list. KerasNLP is based on Keras3 but for now let's focus on the KerasNLP side of things (we also have on-going work for Keras but that's orthogonal).

This PR will add a pretty name for "KerasNLP" tag + add urls to official docs and github repo.
We will be able to generate code snippet in the future as well but it should be clarified first. I suggest that we merge this PR "as-is" and add support for code snippets later when it's ready.

About download counts, KerasNLP uses a config.json file so it should already count correctly.

Bonus: first KerasNLP models on the Hub? https://huggingface.co/google/gemma-2b-it-keras/discussions/2. Model can be loaded with:

import keras_nlp

gemma_lm = keras_nlp.models.GemmaCausalLM.from_preset("hf://google/gemma-2b-it-keras")

🎉

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

on the linked repo you use keras_nlp (with an underscore) as a tag, here you use a dash, which is it?

@julien-c
Copy link
Member

preference for the dash on my side, would be more consistent with other libraries and look nicer

@Wauplin
Copy link
Contributor Author

Wauplin commented Apr 10, 2024

Preference for the dash as well keras-nlp. Will update the linked repo

Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@Wauplin
Copy link
Contributor Author

Wauplin commented Apr 11, 2024

Thanks for fixing the CI @coyotte508!

@Wauplin Wauplin merged commit e8dea82 into main Apr 11, 2024
@Wauplin Wauplin deleted the add-keras-nlp-as-library branch April 11, 2024 08:06
Wauplin added a commit that referenced this pull request Apr 17, 2024
In #616 we added basic
support for the `keras-nlp` library. This PR adds a code snippet for
KerasNLP models. I just got confirmation from @mattdangerw that models
can be loaded with:

```py
import keras_nlp

tokenizer = keras_nlp.models.Tokenizer.from_preset("hf://${model.id}")
backbone = keras_nlp.models.Backbone.from_preset("hf://${model.id}")
```

We might want to do more fancy stuff in the future to parse the
underlying model architecture server-side but in the meantime this is a
valid solution.
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.

4 participants