From cecad1778bb7a2e1f753ed09ef209cb80d63538f Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 22 Mar 2024 16:53:21 +0100 Subject: [PATCH 1/4] use `base_model` to encode that a model is a quantized version of another model --- docs/hub/model-cards.md | 4 ++-- docs/hub/peft.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/hub/model-cards.md b/docs/hub/model-cards.md index 853f7e462..f1157094e 100644 --- a/docs/hub/model-cards.md +++ b/docs/hub/model-cards.md @@ -33,7 +33,7 @@ The metadata you add to the model card supports discovery and easier use of your * Allowing users to filter models at https://huggingface.co/models. * Displaying the model's license. -* Adding datasets to the metadata will add a message reading `Datasets used to train:` to your model card and link the relevant datasets, if they're available on the Hub. +* Adding datasets to the metadata will add a message reading `Datasets used to train:` to your model page and link the relevant datasets, if they're available on the Hub. Dataset, metric, and language identifiers are those listed on the [Datasets](https://huggingface.co/datasets), [Metrics](https://huggingface.co/metrics) and [Languages](https://huggingface.co/languages) pages. @@ -110,7 +110,7 @@ If it's not specified, the Hub will try to automatically detect the library type ### Specifying a base model -If your model is a fine-tune or adapter of a base model, you can specify the base model in the model card metadata section. This information can also be used to indicate if your model is a merge of multiple existing models. The `base_model` field can either be a single model ID, or a list of one or more base_models (specified by their Hub identifier). +If your model is a fine-tune, an adapter, or a quantized version of a base model, you can specify the base model in the model card metadata section. This information can also be used to indicate if your model is a merge of multiple existing models. The `base_model` field can either be a single model ID, or a list of one or more base_models (specified by their Hub identifier). ```yaml base_model: HuggingFaceH4/zephyr-7b-beta diff --git a/docs/hub/peft.md b/docs/hub/peft.md index b091e0015..c37d7827b 100644 --- a/docs/hub/peft.md +++ b/docs/hub/peft.md @@ -18,7 +18,7 @@ $ pip install peft ## Using existing models -All PEFT models can be loaded from the Hub. To use a PEFT model you also need to load the base model that was fine-tuned, as shown below. Every fine-tuned model has the base model in it's model card. +All PEFT models can be loaded from the Hub. To use a PEFT model you also need to load the base model that was fine-tuned, as shown below. Every fine-tuned model has the base model in its model card. ```py from transformers import AutoModelForCausalLM, AutoTokenizer From f5ffa652a81dc47ec43154fda3ee40ca01480c56 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 22 Mar 2024 20:14:52 +0100 Subject: [PATCH 2/4] add some screenshots --- docs/hub/model-cards.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/hub/model-cards.md b/docs/hub/model-cards.md index f1157094e..89d580da0 100644 --- a/docs/hub/model-cards.md +++ b/docs/hub/model-cards.md @@ -123,6 +123,27 @@ This metadata will be used to display the base model on the model page. Users ca +For a merge of two or more models: + +
+ + +
+ +For an adapter (LoRA, PEFT, etc): + +
+ + +
+ +For a quantized version of another model: + +
+ + +
+ ### Specifying a dataset You can specify the datasets used to train your model in the model card metadata section. The datasets will be displayed on the model page and users will be able to filter models by dataset. You should use the Hub dataset identifier, which is the same as the dataset's repo name as the identifier: From 40ce188c99f864961f71f69411644b208993176d Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 29 Mar 2024 12:48:28 +0100 Subject: [PATCH 3/4] Update docs/hub/model-cards.md Co-authored-by: Pedro Cuenca --- docs/hub/model-cards.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hub/model-cards.md b/docs/hub/model-cards.md index 89d580da0..fc4adc591 100644 --- a/docs/hub/model-cards.md +++ b/docs/hub/model-cards.md @@ -110,7 +110,7 @@ If it's not specified, the Hub will try to automatically detect the library type ### Specifying a base model -If your model is a fine-tune, an adapter, or a quantized version of a base model, you can specify the base model in the model card metadata section. This information can also be used to indicate if your model is a merge of multiple existing models. The `base_model` field can either be a single model ID, or a list of one or more base_models (specified by their Hub identifier). +If your model is a fine-tune, an adapter, or a quantized version of a base model, you can specify the base model in the model card metadata section. This information can also be used to indicate if your model is a merge of multiple existing models. The `base_model` field can either be a single model ID, or a list of one or more base_models (specified by their Hub identifiers). ```yaml base_model: HuggingFaceH4/zephyr-7b-beta From 7d2f97e86ec3e385540de47c82745c311897c11b Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 29 Mar 2024 12:57:08 +0100 Subject: [PATCH 4/4] tweak + add the yaml example with two base models --- docs/hub/model-cards.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/hub/model-cards.md b/docs/hub/model-cards.md index fc4adc591..f9b12fd86 100644 --- a/docs/hub/model-cards.md +++ b/docs/hub/model-cards.md @@ -110,26 +110,19 @@ If it's not specified, the Hub will try to automatically detect the library type ### Specifying a base model -If your model is a fine-tune, an adapter, or a quantized version of a base model, you can specify the base model in the model card metadata section. This information can also be used to indicate if your model is a merge of multiple existing models. The `base_model` field can either be a single model ID, or a list of one or more base_models (specified by their Hub identifiers). +If your model is a fine-tune, an adapter, or a quantized version of a base model, you can specify the base model in the model card metadata section. This information can also be used to indicate if your model is a merge of multiple existing models. Hence, the `base_model` field can either be a single model ID, or a list of one or more base_models (specified by their Hub identifiers). ```yaml base_model: HuggingFaceH4/zephyr-7b-beta ``` -This metadata will be used to display the base model on the model page. Users can also use this information to filter models by base model or find models that are fine-tuned from a specific base model. +This metadata will be used to display the base model on the model page. Users can also use this information to filter models by base model or find models that are fine-tuned from a specific base model:
-For a merge of two or more models: - -
- - -
- For an adapter (LoRA, PEFT, etc):
@@ -144,6 +137,21 @@ For a quantized version of another model:
+Finally, for a merge of two or more models: + +
+ + +
+ +In the merge case, you specify a list of two or more base_models: + +```yaml +base_model: +- Endevor/InfinityRP-v1-7B +- l3utterfly/mistral-7b-v0.1-layla-v4 +``` + ### Specifying a dataset You can specify the datasets used to train your model in the model card metadata section. The datasets will be displayed on the model page and users will be able to filter models by dataset. You should use the Hub dataset identifier, which is the same as the dataset's repo name as the identifier: