Instructions to use JohanHeinsen/PE_header_classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use JohanHeinsen/PE_header_classifier with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("JohanHeinsen/PE_header_classifier") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - setfit
How to use JohanHeinsen/PE_header_classifier with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("JohanHeinsen/PE_header_classifier") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,7 +9,9 @@ pipeline_tag: text-classification
|
|
| 9 |
|
| 10 |
# /private/var/folders/6b/0g07c1bd5nx_dqlnklk5kq5h0000gn/T/tmpn6ptrcp2/JohanHeinsen/PE_header_classifier
|
| 11 |
|
| 12 |
-
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification.
|
|
|
|
|
|
|
| 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.
|
|
@@ -30,9 +32,13 @@ from setfit import SetFitModel
|
|
| 30 |
# Download from Hub and run inference
|
| 31 |
model = SetFitModel.from_pretrained("/private/var/folders/6b/0g07c1bd5nx_dqlnklk5kq5h0000gn/T/tmpn6ptrcp2/JohanHeinsen/PE_header_classifier")
|
| 32 |
# Run inference
|
| 33 |
-
preds = model(["
|
| 34 |
```
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
## BibTeX entry and citation info
|
| 37 |
|
| 38 |
```bibtex
|
|
|
|
| 9 |
|
| 10 |
# /private/var/folders/6b/0g07c1bd5nx_dqlnklk5kq5h0000gn/T/tmpn6ptrcp2/JohanHeinsen/PE_header_classifier
|
| 11 |
|
| 12 |
+
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for text classification. It was created to identify headers in the publication Politiets Efterretninger (1867–1890)
|
| 13 |
+
|
| 14 |
+
The model has been trained using an efficient few-shot learning technique that involves:
|
| 15 |
|
| 16 |
1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning.
|
| 17 |
2. Training a classification head with features from the fine-tuned Sentence Transformer.
|
|
|
|
| 32 |
# Download from Hub and run inference
|
| 33 |
model = SetFitModel.from_pretrained("/private/var/folders/6b/0g07c1bd5nx_dqlnklk5kq5h0000gn/T/tmpn6ptrcp2/JohanHeinsen/PE_header_classifier")
|
| 34 |
# Run inference
|
| 35 |
+
preds = model(["VI. Andre meddelelser", "1) Reserven er løbet bort."])
|
| 36 |
```
|
| 37 |
|
| 38 |
+
## Metrics:
|
| 39 |
+
Accuracy: 0.9977494373593399
|
| 40 |
+
F1: 0.953125
|
| 41 |
+
|
| 42 |
## BibTeX entry and citation info
|
| 43 |
|
| 44 |
```bibtex
|