Skip to content

Update model contribution guide #2254

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

divyashreepathihalli
Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli commented May 16, 2025

Since KerasHub has evolved, updating the model contribution guides. This will make contributions consistent and lower review time.
Markdown preview here
https://github.com/divyashreepathihalli/keras-nlp/blob/contributing_guide/CONTRIBUTING_MODELS.md

@divyashreepathihalli divyashreepathihalli marked this pull request as draft May 16, 2025 20:27
@divyashreepathihalli divyashreepathihalli changed the title Update contributing guide [WIP] Update contributing guide May 16, 2025
@divyashreepathihalli divyashreepathihalli changed the title [WIP] Update contributing guide Update contributing guide May 16, 2025
@divyashreepathihalli divyashreepathihalli marked this pull request as ready for review May 16, 2025 23:02
@divyashreepathihalli divyashreepathihalli changed the title Update contributing guide Update model contribution guide May 16, 2025
Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

Thanks! Left some comments.


- [ ] Open an issue or find an issue to contribute a backbone model.

### Step 2: PR #1 - Add XXBackbone
### Step 2: PR #1 - Model Folder
Copy link
Member

Choose a reason for hiding this comment

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

Do we want this many PRs? Might be better to ask for a single PR with backbone, initial task, and colab showing usage and results. Less likely to have incomplete model contributions.

I'd say definitely not this, we don't want people opening up PRs just to create empty model folders. That is just more review for us (with nothing of value in the PR).


### Step 4: PR #3 - Add XX Presets
### Step 5: PR #3 - Add `XX` Tasks and Preprocessors (Optional)
Copy link
Member

Choose a reason for hiding this comment

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

We might want to consider saying at least one task is not optional.


#### Unit Tests
[Example](https://github.com/keras-team/keras-hub/blob/master/keras_hub/src/models/distil_bert/distil_bert_backbone.py#L187-L189)
Copy link
Member

Choose a reason for hiding this comment

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

You are adding a lot of outdated code links that no longer work. Please check all these!

and return the dictionary in the form expected by the model.
- New Task Models (e.g., TokenClassifier, ImageSegmentation)
- Parameter-Efficient Fine-Tuning (LoRA support)
- Quantization (QLoRA support)
Copy link
Member

Choose a reason for hiding this comment

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

what do we expect to be added for lora and qlora support? this seems kinda ill defined

- [ ] Add `xx/xx_presets.py` with links to weights uploaded to Kaggle KerasHub
[Example](https://github.com/keras-team/keras-hub/blob/master/keras_hub/src/models/distil_bert/distil_bert_presets.py)

- [ ] Stage the model presets on KerasHub’s [Kaggle org page](https://www.kaggle.com/organizations/kerashub) using this [invite link](https://kaggle.com/organizations/kerashub/invite/c4b8baa532b8436e8df8f1ed641b9cb5)
Copy link
Member

Choose a reason for hiding this comment

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

We might not want to make this invite link public. Won't anyone be able to join the org with this? What kind of permissions does this get you (model creation? model deletion?).


### Step 4: PR #3 - Add XX Presets
#### Checkpoint Conversion Script (tools/checkpoint_conversion/convert_your_model_checkpoints.py)
Copy link
Member

Choose a reason for hiding this comment

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

We should mention timm/huggingface converters. And show one of those as the primary example.

Basically, we should say that is our preferred mode of checkpoint is to go from a supported conversion source (timm, transformers) and write a built in library converted. Then the convert checkpoint tool is just a thin wrapper around this converter.

Alternately (and more advanced) would be to write a converted from another format, directly in the tools/ script.


##### Implementation

- **Text**: `XXTokenizer`, subclassing from KerasHub tokenizers
Copy link
Member

Choose a reason for hiding this comment

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

Probably should link these code files (tokenizer, imageconverter, audioconverter).

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.

2 participants