From 0e39f673bc89cbfb616ba5036c0718ed74e494e2 Mon Sep 17 00:00:00 2001 From: Wauplin Date: Thu, 19 Sep 2024 15:32:26 +0200 Subject: [PATCH 1/2] Add a PR template with a checklist to add a new library to the Hub --- .github/pull_request_template/new_library.md | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/pull_request_template/new_library.md diff --git a/.github/pull_request_template/new_library.md b/.github/pull_request_template/new_library.md new file mode 100644 index 0000000000..9dc54d4e94 --- /dev/null +++ b/.github/pull_request_template/new_library.md @@ -0,0 +1,33 @@ +# What does this PR do? + +This PR adds support for the library [TO BE COMPLETED]. + +Link to library repo: [TO BE COMPLETED]. + +Link to models on the Hub: https://huggingface.co/models?other=[to-be-completed]. + +## Main instructions + +Please check that all prerequisites are met. + +- [ ] A new library has been added to [model-libraries.ts](https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/model-libraries.ts#L60). +- [ ] The alphabetical order of `MODEL_LIBRARIES_UI_ELEMENTS` has been preserved. +- [ ] The library id is lowercased and hyphen-separated (example: `"adapter-transformers"`). +- [ ] At least one model is referenced on https://huggingface.co/models?other=my-library-name. If not, the model card metadata of the relevant models must be updated to add `library_name: my-library-name` (see [example](https://huggingface.co/google/gemma-scope/blob/main/README.md?code=true#L3)). If you are not the owner of the models on the Hub, please open PRs (see [example](https://huggingface.co/MCG-NJU/VFIMamba/discussions/1)). **Note:** if no models are listed, this PR won't be merged. +- [ ] `repoName` and `prettyLabel` are set with user-friendly casing (example: `DeepForest`). +- [ ] `repoUrl` is set with a link to the library source code (usually a GitHub repository). +- [ ] (optional) `docsUrl` is set with a link to the docs of the library. If the documentation is in the GitHub repo referenced above, no need to set it twice. +- [ ] `filter` is set to `false`. +- [ ] `countDownload` follows the correct convention and do not duplicate the counting. For instance, if loading a model requires 3 files, the download count rule must count downloads only on 1 of the 3 files. Otherwise, the download count will be overestimated. If the library uses one of the default config files (`config.json`, `config.yaml`, `hyperparams.yaml`, and `meta.yaml`, see [here](https://huggingface.co/docs/hub/models-download-stats#which-are-the-query-files-for-different-libraries)), there is no need to manually define a download count rule. +- [ ] (optional) `snippets` is correctly defined. See check-list below. + +## Snippets instructions + +Adding a code snippet helps users to start using your library. It is especially useful when the library is tightly integrated with the Hub and typically has a `Model.from_pretrained` helper method. Check out [this guide](https://huggingface.co/docs/huggingface_hub/guides/download) to learn how to download files in Python and [this guide](https://huggingface.co/docs/huggingface_hub/guides/integrations) for a broader explanation on how to integrate a library with the Hub. Note that adding a code snippet is optional. +For code snippets specifically, please refer to this checklist: + +- [ ] Code snippet has been defined in [model-libraries-snippets.ts](https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/model-libraries-snippets.ts) and added to [model-libraries.ts](https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/model-libraries.ts#L60). +- [ ] Code snippet does not contain installation instruction. +- [ ] Code snippet is minimal (only loading / calling the model with simple config). +- [ ] (recommended) Code snippet is generated from `ModelData`, typically to get the correct command to load a specific model. +- [ ] (optional) It's possible to define multiple code snippets (by returning a list) to showcase different usage. From b54ffcce546f703f087e071300212e00a579559c Mon Sep 17 00:00:00 2001 From: Wauplin Date: Fri, 20 Sep 2024 12:48:58 +0200 Subject: [PATCH 2/2] address feedback --- .github/pull_request_template/new_library.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template/new_library.md b/.github/pull_request_template/new_library.md index 9dc54d4e94..069d18f068 100644 --- a/.github/pull_request_template/new_library.md +++ b/.github/pull_request_template/new_library.md @@ -20,8 +20,9 @@ Please check that all prerequisites are met. - [ ] `filter` is set to `false`. - [ ] `countDownload` follows the correct convention and do not duplicate the counting. For instance, if loading a model requires 3 files, the download count rule must count downloads only on 1 of the 3 files. Otherwise, the download count will be overestimated. If the library uses one of the default config files (`config.json`, `config.yaml`, `hyperparams.yaml`, and `meta.yaml`, see [here](https://huggingface.co/docs/hub/models-download-stats#which-are-the-query-files-for-different-libraries)), there is no need to manually define a download count rule. - [ ] (optional) `snippets` is correctly defined. See check-list below. +- [ ] Make sure that the code passes the linter test as well -## Snippets instructions +## (optional) Snippets instructions Adding a code snippet helps users to start using your library. It is especially useful when the library is tightly integrated with the Hub and typically has a `Model.from_pretrained` helper method. Check out [this guide](https://huggingface.co/docs/huggingface_hub/guides/download) to learn how to download files in Python and [this guide](https://huggingface.co/docs/huggingface_hub/guides/integrations) for a broader explanation on how to integrate a library with the Hub. Note that adding a code snippet is optional. For code snippets specifically, please refer to this checklist: