CI: модель обучена и загружена (402301b)
Browse files- README.md +61 -57
- config_setfit.json +2 -2
README.md
CHANGED
|
@@ -32,35 +32,35 @@ model-index:
|
|
| 32 |
name: Accuracy
|
| 33 |
---
|
| 34 |
|
| 35 |
-
# SetFit
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
1.
|
| 42 |
-
2.
|
| 43 |
|
| 44 |
-
##
|
| 45 |
|
| 46 |
-
###
|
| 47 |
-
-
|
| 48 |
-
-
|
| 49 |
-
-
|
| 50 |
-
-
|
| 51 |
-
-
|
| 52 |
-
<!-- -
|
| 53 |
-
<!-- -
|
| 54 |
-
<!-- -
|
| 55 |
|
| 56 |
-
###
|
| 57 |
|
| 58 |
-
-
|
| 59 |
-
-
|
| 60 |
-
-
|
| 61 |
|
| 62 |
-
###
|
| 63 |
-
|
|
| 64 |
|:-------------------|:------------------------------------------------------------------------------------------------------------------------------|
|
| 65 |
| unknown | <ul><li>'чей робот'</li><li>'опять лежать'</li><li>'смотри панда'</li></ul> |
|
| 66 |
| stand_at_attention | <ul><li>'пора выравняться'</li><li>'не хочешь равняться'</li><li>'выравнялся бы'</li></ul> |
|
|
@@ -76,64 +76,66 @@ model-index:
|
|
| 76 |
| run | <ul><li>'надо бежать'</li><li>'побеги'</li><li>'хотела бы чтобы панда бежала'</li></ul> |
|
| 77 |
| help | <ul><li>'надо помочь'</li><li>'помог бы'</li><li>'команды'</li></ul> |
|
| 78 |
|
| 79 |
-
##
|
| 80 |
|
| 81 |
-
###
|
| 82 |
-
|
|
| 83 |
|:--------|:---------|
|
| 84 |
-
|
|
| 85 |
|
| 86 |
-
##
|
| 87 |
|
| 88 |
-
###
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
```bash
|
| 93 |
pip install setfit
|
| 94 |
```
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
```python
|
| 99 |
from setfit import SetFitModel
|
| 100 |
|
| 101 |
-
#
|
| 102 |
-
model = SetFitModel.from_pretrained("
|
| 103 |
-
#
|
| 104 |
preds = model("беги бы")
|
| 105 |
```
|
| 106 |
|
| 107 |
<!--
|
| 108 |
-
###
|
| 109 |
|
| 110 |
-
|
| 111 |
-->
|
| 112 |
|
| 113 |
<!--
|
| 114 |
-
###
|
| 115 |
|
| 116 |
-
|
| 117 |
-->
|
|
|
|
| 118 |
<!--
|
| 119 |
-
##
|
| 120 |
|
| 121 |
-
|
| 122 |
-->
|
|
|
|
| 123 |
<!--
|
| 124 |
-
###
|
| 125 |
|
| 126 |
-
|
| 127 |
-->
|
| 128 |
|
| 129 |
-
##
|
| 130 |
|
| 131 |
-
###
|
| 132 |
-
|
|
| 133 |
|:-------------|:----|:-------|:----|
|
| 134 |
-
|
|
| 135 |
|
| 136 |
-
|
|
| 137 |
|:-------------------|:----------------------|
|
| 138 |
| bind | 44 |
|
| 139 |
| dismiss | 128 |
|
|
@@ -149,7 +151,7 @@ preds = model("беги бы")
|
|
| 149 |
| unbind | 30 |
|
| 150 |
| unknown | 381 |
|
| 151 |
|
| 152 |
-
###
|
| 153 |
- batch_size: (128, 128)
|
| 154 |
- num_epochs: (1, 1)
|
| 155 |
- max_steps: -1
|
|
@@ -168,8 +170,8 @@ preds = model("беги бы")
|
|
| 168 |
- eval_max_steps: -1
|
| 169 |
- load_best_model_at_end: False
|
| 170 |
|
| 171 |
-
###
|
| 172 |
-
|
|
| 173 |
|:------:|:----:|:-------------:|:---------------:|
|
| 174 |
| 0.0025 | 1 | 0.2328 | - |
|
| 175 |
| 0.1253 | 50 | 0.0955 | - |
|
|
@@ -180,7 +182,7 @@ preds = model("беги бы")
|
|
| 180 |
| 0.7519 | 300 | 0.0031 | - |
|
| 181 |
| 0.8772 | 350 | 0.0022 | - |
|
| 182 |
|
| 183 |
-
###
|
| 184 |
- Python: 3.11.14
|
| 185 |
- SetFit: 1.1.3
|
| 186 |
- Sentence Transformers: 5.2.2
|
|
@@ -189,7 +191,7 @@ preds = model("беги бы")
|
|
| 189 |
- Datasets: 4.5.0
|
| 190 |
- Tokenizers: 0.22.2
|
| 191 |
|
| 192 |
-
##
|
| 193 |
|
| 194 |
### BibTeX
|
| 195 |
```bibtex
|
|
@@ -206,17 +208,19 @@ preds = model("беги бы")
|
|
| 206 |
```
|
| 207 |
|
| 208 |
<!--
|
| 209 |
-
##
|
| 210 |
|
| 211 |
-
|
| 212 |
-->
|
|
|
|
| 213 |
<!--
|
| 214 |
-
##
|
| 215 |
|
| 216 |
-
|
| 217 |
-->
|
|
|
|
| 218 |
<!--
|
| 219 |
-
##
|
| 220 |
|
| 221 |
-
|
| 222 |
-
-->
|
|
|
|
| 32 |
name: Accuracy
|
| 33 |
---
|
| 34 |
|
| 35 |
+
# SetFit with google/embeddinggemma-300M
|
| 36 |
|
| 37 |
+
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [google/embeddinggemma-300M](https://huggingface.co/google/embeddinggemma-300M) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
|
| 38 |
|
| 39 |
+
The model has been trained using an efficient few-shot learning technique that involves:
|
| 40 |
|
| 41 |
+
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
|
| 42 |
+
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
| 43 |
|
| 44 |
+
## Model Details
|
| 45 |
|
| 46 |
+
### Model Description
|
| 47 |
+
- **Model Type:** SetFit
|
| 48 |
+
- **Sentence Transformer body:** [google/embeddinggemma-300M](https://huggingface.co/google/embeddinggemma-300M)
|
| 49 |
+
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
|
| 50 |
+
- **Maximum Sequence Length:** 2048 tokens
|
| 51 |
+
- **Number of Classes:** 13 classes
|
| 52 |
+
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
|
| 53 |
+
<!-- - **Language:** Unknown -->
|
| 54 |
+
<!-- - **License:** Unknown -->
|
| 55 |
|
| 56 |
+
### Model Sources
|
| 57 |
|
| 58 |
+
- **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit)
|
| 59 |
+
- **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055)
|
| 60 |
+
- **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit)
|
| 61 |
|
| 62 |
+
### Model Labels
|
| 63 |
+
| Label | Examples |
|
| 64 |
|:-------------------|:------------------------------------------------------------------------------------------------------------------------------|
|
| 65 |
| unknown | <ul><li>'чей робот'</li><li>'опять лежать'</li><li>'смотри панда'</li></ul> |
|
| 66 |
| stand_at_attention | <ul><li>'пора выравняться'</li><li>'не хочешь равняться'</li><li>'выравнялся бы'</li></ul> |
|
|
|
|
| 76 |
| run | <ul><li>'надо бежать'</li><li>'побеги'</li><li>'хотела бы чтобы панда бежала'</li></ul> |
|
| 77 |
| help | <ul><li>'надо помочь'</li><li>'помог бы'</li><li>'команды'</li></ul> |
|
| 78 |
|
| 79 |
+
## Evaluation
|
| 80 |
|
| 81 |
+
### Metrics
|
| 82 |
+
| Label | Accuracy |
|
| 83 |
|:--------|:---------|
|
| 84 |
+
| **all** | 0.8903 |
|
| 85 |
|
| 86 |
+
## Uses
|
| 87 |
|
| 88 |
+
### Direct Use for Inference
|
| 89 |
|
| 90 |
+
First install the SetFit library:
|
| 91 |
|
| 92 |
```bash
|
| 93 |
pip install setfit
|
| 94 |
```
|
| 95 |
|
| 96 |
+
Then you can load this model and run inference.
|
| 97 |
|
| 98 |
```python
|
| 99 |
from setfit import SetFitModel
|
| 100 |
|
| 101 |
+
# Download from the 🤗 Hub
|
| 102 |
+
model = SetFitModel.from_pretrained("tmp__yp10ai/panda_commands")
|
| 103 |
+
# Run inference
|
| 104 |
preds = model("беги бы")
|
| 105 |
```
|
| 106 |
|
| 107 |
<!--
|
| 108 |
+
### Downstream Use
|
| 109 |
|
| 110 |
+
*List how someone could finetune this model on their own dataset.*
|
| 111 |
-->
|
| 112 |
|
| 113 |
<!--
|
| 114 |
+
### Out-of-Scope Use
|
| 115 |
|
| 116 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 117 |
-->
|
| 118 |
+
|
| 119 |
<!--
|
| 120 |
+
## Bias, Risks and Limitations
|
| 121 |
|
| 122 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 123 |
-->
|
| 124 |
+
|
| 125 |
<!--
|
| 126 |
+
### Recommendations
|
| 127 |
|
| 128 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 129 |
-->
|
| 130 |
|
| 131 |
+
## Training Details
|
| 132 |
|
| 133 |
+
### Training Set Metrics
|
| 134 |
+
| Training set | Min | Median | Max |
|
| 135 |
|:-------------|:----|:-------|:----|
|
| 136 |
+
| Word count | 1 | 2.3697 | 7 |
|
| 137 |
|
| 138 |
+
| Label | Training Sample Count |
|
| 139 |
|:-------------------|:----------------------|
|
| 140 |
| bind | 44 |
|
| 141 |
| dismiss | 128 |
|
|
|
|
| 151 |
| unbind | 30 |
|
| 152 |
| unknown | 381 |
|
| 153 |
|
| 154 |
+
### Training Hyperparameters
|
| 155 |
- batch_size: (128, 128)
|
| 156 |
- num_epochs: (1, 1)
|
| 157 |
- max_steps: -1
|
|
|
|
| 170 |
- eval_max_steps: -1
|
| 171 |
- load_best_model_at_end: False
|
| 172 |
|
| 173 |
+
### Training Results
|
| 174 |
+
| Epoch | Step | Training Loss | Validation Loss |
|
| 175 |
|:------:|:----:|:-------------:|:---------------:|
|
| 176 |
| 0.0025 | 1 | 0.2328 | - |
|
| 177 |
| 0.1253 | 50 | 0.0955 | - |
|
|
|
|
| 182 |
| 0.7519 | 300 | 0.0031 | - |
|
| 183 |
| 0.8772 | 350 | 0.0022 | - |
|
| 184 |
|
| 185 |
+
### Framework Versions
|
| 186 |
- Python: 3.11.14
|
| 187 |
- SetFit: 1.1.3
|
| 188 |
- Sentence Transformers: 5.2.2
|
|
|
|
| 191 |
- Datasets: 4.5.0
|
| 192 |
- Tokenizers: 0.22.2
|
| 193 |
|
| 194 |
+
## Citation
|
| 195 |
|
| 196 |
### BibTeX
|
| 197 |
```bibtex
|
|
|
|
| 208 |
```
|
| 209 |
|
| 210 |
<!--
|
| 211 |
+
## Glossary
|
| 212 |
|
| 213 |
+
*Clearly define terms in order to be accessible across audiences.*
|
| 214 |
-->
|
| 215 |
+
|
| 216 |
<!--
|
| 217 |
+
## Model Card Authors
|
| 218 |
|
| 219 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
| 220 |
-->
|
| 221 |
+
|
| 222 |
<!--
|
| 223 |
+
## Model Card Contact
|
| 224 |
|
| 225 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 226 |
+
-->
|
config_setfit.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"labels": [
|
| 3 |
"bind",
|
| 4 |
"dismiss",
|
|
@@ -13,6 +14,5 @@
|
|
| 13 |
"stop_running",
|
| 14 |
"unbind",
|
| 15 |
"unknown"
|
| 16 |
-
]
|
| 17 |
-
"normalize_embeddings": false
|
| 18 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"normalize_embeddings": false,
|
| 3 |
"labels": [
|
| 4 |
"bind",
|
| 5 |
"dismiss",
|
|
|
|
| 14 |
"stop_running",
|
| 15 |
"unbind",
|
| 16 |
"unknown"
|
| 17 |
+
]
|
|
|
|
| 18 |
}
|