PhilipMay commited on
Commit
c072ba6
·
1 Parent(s): 1c50e4c

update README

Browse files
Files changed (1) hide show
  1. README.md +13 -110
README.md CHANGED
@@ -4,119 +4,28 @@ language:
4
  - de
5
  tags:
6
  - sentence-transformers
7
- - feature-extraction
8
  - sentence-similarity
9
  - transformers
 
 
 
 
 
 
10
 
11
  ---
12
 
13
- # {MODEL_NAME}
14
-
15
- 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.
16
-
17
- <!--- Describe your model here -->
18
-
19
- ## Usage (Sentence-Transformers)
20
-
21
- Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
22
-
23
- ```
24
- pip install -U sentence-transformers
25
- ```
26
-
27
- Then you can use the model like this:
28
-
29
- ```python
30
- from sentence_transformers import SentenceTransformer
31
- sentences = ["This is an example sentence", "Each sentence is converted"]
32
-
33
- model = SentenceTransformer('{MODEL_NAME}')
34
- embeddings = model.encode(sentences)
35
- print(embeddings)
36
- ```
37
-
38
-
39
-
40
- ## Usage (HuggingFace Transformers)
41
- Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
42
-
43
- ```python
44
- from transformers import AutoTokenizer, AutoModel
45
- import torch
46
-
47
-
48
- #Mean Pooling - Take attention mask into account for correct averaging
49
- def mean_pooling(model_output, attention_mask):
50
- token_embeddings = model_output[0] #First element of model_output contains all token embeddings
51
- input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
52
- return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
53
-
54
-
55
- # Sentences we want sentence embeddings for
56
- sentences = ['This is an example sentence', 'Each sentence is converted']
57
-
58
- # Load model from HuggingFace Hub
59
- tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
60
- model = AutoModel.from_pretrained('{MODEL_NAME}')
61
-
62
- # Tokenize sentences
63
- encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
64
-
65
- # Compute token embeddings
66
- with torch.no_grad():
67
- model_output = model(**encoded_input)
68
-
69
- # Perform pooling. In this case, mean pooling.
70
- sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
71
-
72
- print("Sentence embeddings:")
73
- print(sentence_embeddings)
74
- ```
75
-
76
-
77
 
78
  ## Evaluation Results
79
-
80
- <!--- Describe how your model was evaluated -->
81
-
82
- For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
83
-
84
 
85
  ## Training
86
- The model was trained with the parameters:
87
-
88
- **DataLoader**:
89
-
90
- `torch.utils.data.dataloader.DataLoader` of length 26560 with parameters:
91
- ```
92
- {'batch_size': 57, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
93
- ```
94
-
95
- **Loss**:
96
-
97
- `sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss` with parameters:
98
- ```
99
- {'scale': 20.0, 'similarity_fct': 'cos_sim'}
100
- ```
101
-
102
- Parameters of the fit()-Method:
103
- ```
104
- {
105
- "epochs": 7,
106
- "evaluation_steps": 5312,
107
- "evaluator": "sentence_transformers.evaluation.EmbeddingSimilarityEvaluator.EmbeddingSimilarityEvaluator",
108
- "max_grad_norm": 1,
109
- "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
110
- "optimizer_params": {
111
- "lr": 8.345726930229726e-06
112
- },
113
- "scheduler": "WarmupLinear",
114
- "steps_per_epoch": null,
115
- "warmup_steps": 55776,
116
- "weight_decay": 0.01
117
- }
118
- ```
119
-
120
 
121
  ## Full Model Architecture
122
  ```
@@ -126,13 +35,7 @@ SentenceTransformer(
126
  )
127
  ```
128
 
129
- ## Citing & Authors
130
-
131
- <!--- Describe where people can find more information -->
132
-
133
-
134
  ## Licensing
135
-
136
  Copyright (c) 2023 [Philip May](https://may.la/), [Deutsche Telekom AG](https://www.telekom.com/)\
137
  Copyright (c) 2022 [deepset GmbH](https://www.deepset.ai/)
138
 
 
4
  - de
5
  tags:
6
  - sentence-transformers
 
7
  - sentence-similarity
8
  - transformers
9
+ - setfit
10
+ license: mit
11
+ metrics:
12
+ - cosine similarity
13
+ datasets:
14
+ - deutsche-telekom/ger-backtrans-paraphrase
15
 
16
  ---
17
 
18
+ # German BERT large paraphrase cosine
19
+ This is a [sentence-transformers](https://www.SBERT.net) model:
20
+ It maps sentences & paragraphs (text) into a 1024 dimensional dense vector space.
21
+ The model is intended to be used together with [SetFit](https://github.com/huggingface/setfit)
22
+ to improve German few-shot text classification.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ## Evaluation Results
25
+ TODO
 
 
 
 
26
 
27
  ## Training
28
+ TODO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ## Full Model Architecture
31
  ```
 
35
  )
36
  ```
37
 
 
 
 
 
 
38
  ## Licensing
 
39
  Copyright (c) 2023 [Philip May](https://may.la/), [Deutsche Telekom AG](https://www.telekom.com/)\
40
  Copyright (c) 2022 [deepset GmbH](https://www.deepset.ai/)
41