Sentence Similarity
setfit
PyTorch
bert
feature-extraction
e5
KnutJaegersberg commited on
Commit
5da8d2e
1 Parent(s): f65aba2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +15 -76
README.md CHANGED
@@ -1,88 +1,27 @@
1
  ---
2
  pipeline_tag: sentence-similarity
3
  tags:
4
- - sentence-transformers
5
  - feature-extraction
6
  - sentence-similarity
7
-
 
 
 
 
 
8
  ---
9
 
10
- # {MODEL_NAME}
11
-
12
- This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 1024 dimensional dense vector space and can be used for tasks like clustering or semantic search.
13
-
14
- <!--- Describe your model here -->
15
-
16
- ## Usage (Sentence-Transformers)
17
-
18
- Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
19
-
20
- ```
21
- pip install -U sentence-transformers
22
- ```
23
-
24
- Then you can use the model like this:
25
-
26
- ```python
27
- from sentence_transformers import SentenceTransformer
28
- sentences = ["This is an example sentence", "Each sentence is converted"]
29
-
30
- model = SentenceTransformer('{MODEL_NAME}')
31
- embeddings = model.encode(sentences)
32
- print(embeddings)
33
- ```
34
-
35
-
36
-
37
- ## Evaluation Results
38
-
39
- <!--- Describe how your model was evaluated -->
40
-
41
- For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
42
-
43
-
44
- ## Training
45
- The model was trained with the parameters:
46
-
47
- **DataLoader**:
48
-
49
- `torch.utils.data.dataloader.DataLoader` of length 133200 with parameters:
50
- ```
51
- {'batch_size': 8, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
52
- ```
53
-
54
- **Loss**:
55
-
56
- `sentence_transformers.losses.CosineSimilarityLoss.CosineSimilarityLoss`
57
 
58
- Parameters of the fit()-Method:
59
- ```
60
- {
61
- "epochs": 2,
62
- "evaluation_steps": 0,
63
- "evaluator": "NoneType",
64
- "max_grad_norm": 1,
65
- "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
66
- "optimizer_params": {
67
- "lr": 2e-05
68
- },
69
- "scheduler": "WarmupLinear",
70
- "steps_per_epoch": 266400,
71
- "warmup_steps": 26640,
72
- "weight_decay": 0.01
73
- }
74
- ```
75
 
76
 
77
- ## Full Model Architecture
78
- ```
79
- SentenceTransformer(
80
- (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
81
- (1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False})
82
- (2): Normalize()
83
- )
84
- ```
85
 
86
- ## Citing & Authors
 
87
 
88
- <!--- Describe where people can find more information -->
 
 
1
  ---
2
  pipeline_tag: sentence-similarity
3
  tags:
 
4
  - feature-extraction
5
  - sentence-similarity
6
+ - setfit
7
+ - e5
8
+ license: mit
9
+ datasets:
10
+ - KnutJaegersberg/wikipedia_categories
11
+ - KnutJaegersberg/wikipedia_categories_labels
12
  ---
13
 
14
+ This English model predicts the top 2 levels of the wikipedia categories (roundabout 1100 labels). It is trained on the concatenation of the headlines of the lower level categories articles in few shot setting (i.e. 8 subcategories with their headline concatenations per level 2 category).
15
+ Accuracy on test data split of the higher category level (37 labels) is 73 % and on level 2 is 60%.
16
+ Note that these numbers are just an indicator that training worked, it will differ in production settings, which is why this classifier is meant for corpus exploration.
17
+ Use the wikipedia_categories_labels dataset as key.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
 
21
+ from setfit import SetFitModel
 
 
 
 
 
 
 
22
 
23
+ Download from Hub and run inference
24
+ model = SetFitModel.from_pretrained("KnutJaegersberg/wikipedia_categories_setfit")
25
 
26
+ Run inference
27
+ preds = model(["Rachel Dolezal Faces Felony Charges For Welfare Fraud", "Elon Musk just got lucky", "The hype on AI is different from the hype on other tech topics"])