Skip to content

initial keras-hub support #986

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 10 commits into from
Oct 30, 2024
Merged

initial keras-hub support #986

merged 10 commits into from
Oct 30, 2024

Conversation

martin-gorner
Copy link
Contributor

Initial support for Keras-hub:

  • generic snippet for loading models
  • library definition with metadata

Comment on lines +399 to +400
# Possible tasks are CausalLM, TextToImage, ImageClassifier, ...
# full list here: https://keras.io/api/keras_hub/models/#api-documentation
Copy link
Member

Choose a reason for hiding this comment

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

do you know if there's a way to know which task/architecture to use, depending on what's inside the repo? (or a manual tag set by keras.push?)

Copy link
Contributor

Choose a reason for hiding this comment

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

looking at https://huggingface.co/martin-gorner/llama-3.2-1B-pirate-instruct, it seems the architecture is pushed with the model card:

This model is related to a CausalLM task.

So yeah agree with Julien that if we can have this info in the metadata, it would be awesome so simplify the snippet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm currently investigating this. Yes, this would be the best solution. I do see a text-generation "pipeline-tag" on models that I upload. This is probably what we should use. It won't be part of this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😫 right now the pipeline-tag is only populated for CausalLM and TextClassifier models.
https://github.com/keras-team/keras-hub/blob/a45110ee4f04750cf43214b591847cffa1074310/keras_hub/src/utils/preset_utils.py#L320

Copy link
Contributor Author

Choose a reason for hiding this comment

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

btw, the "example use" section on Kaggle is much more complete. For reference: https://www.kaggle.com/models/keras/gemma2

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, the "example use" section on Kaggle is much more complete. For reference: https://www.kaggle.com/models/keras/gemma2

I feel that this kind of completeness should be written in the model card directly. For example, https://huggingface.co/google/gemma-2-9b-keras model card could contain code snippets on how to generate and fit on data. What we try to achieve in "use this model" is to have a small, self-contained and personalized snippet to load a model

Copy link
Member

Choose a reason for hiding this comment

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

agree

Copy link
Member

Choose a reason for hiding this comment

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

+1 on making the snippet more complete; in general, we've been pushing for more complete, end-to-end snippets that people can just copy and run.

@martin-gorner
Copy link
Contributor Author

Not sure about the tests failing. It does not look like it's related to this PR, is it?

@Wauplin
Copy link
Contributor

Wauplin commented Oct 25, 2024

(failing tests don't seem related no)

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Looks good to merge! :)

To sum-up, follow-up PRs will be about 1. parsing task.json for better code snippets 2. removing keras-nlp library entirely (in a few weeks?).

Failing CI doesn't seem related to this PR. Let's wait for another approval given the discussions in this PR :)

@pcuenca pcuenca mentioned this pull request Oct 28, 2024
@martin-gorner martin-gorner merged commit 3881d12 into huggingface:main Oct 30, 2024
4 checks passed
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.

5 participants