Update README.md
Browse files
README.md
CHANGED
@@ -11,10 +11,11 @@ pipeline_tag: text-classification
|
|
11 |
|
12 |
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification. The model has been trained using an efficient few-shot learning technique that involves:
|
13 |
|
14 |
-
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
|
15 |
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
16 |
|
17 |
-
This model was finetuned with the dataset `joshuapsa/gpt-generated-news-sentences
|
|
|
18 |
|
19 |
## Usage
|
20 |
|
@@ -30,10 +31,12 @@ You can then run inference as follows:
|
|
30 |
from setfit import SetFitModel
|
31 |
|
32 |
# Download from Hub and run inference
|
33 |
-
model = SetFitModel.from_pretrained("joshuapsa/setfit-
|
34 |
# Run inference
|
35 |
preds = model(["Tensions escalated in the Taiwan Strait as Chinese and Taiwanese naval vessels engaged in a standoff, raising fears of a potential conflict.",\
|
36 |
"Following the highway closure in Toronto, transportation officials announce plans for the construction of additional lanes and improved traffic management systems."])
|
|
|
|
|
37 |
```
|
38 |
|
39 |
## BibTeX entry and citation info
|
|
|
11 |
|
12 |
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification. The model has been trained using an efficient few-shot learning technique that involves:
|
13 |
|
14 |
+
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning ("sentence-transformers/paraphrase-mpnet-base-v2" specifically in this case).
|
15 |
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
16 |
|
17 |
+
This model was finetuned with the custom dataset `joshuapsa/gpt-generated-news-sentences`, which is a synthetic dataset containing news sentences and their topics.<br>
|
18 |
+
Please refer to this to understand the label meanings of the prediction output.
|
19 |
|
20 |
## Usage
|
21 |
|
|
|
31 |
from setfit import SetFitModel
|
32 |
|
33 |
# Download from Hub and run inference
|
34 |
+
model = SetFitModel.from_pretrained("joshuapsa/setfit-news-topic-sentences")
|
35 |
# Run inference
|
36 |
preds = model(["Tensions escalated in the Taiwan Strait as Chinese and Taiwanese naval vessels engaged in a standoff, raising fears of a potential conflict.",\
|
37 |
"Following the highway closure in Toronto, transportation officials announce plans for the construction of additional lanes and improved traffic management systems."])
|
38 |
+
# The underlying model body of the setfit model is a SentenceTransformer model, hence you can use it to encode a raw sentence into dense embeddings:
|
39 |
+
emb = model.model_body.encode("Your sentence goes here")
|
40 |
```
|
41 |
|
42 |
## BibTeX entry and citation info
|