charlesdedampierre
commited on
Commit
·
5b9506c
1
Parent(s):
5cf27bc
Update README.md
Browse files
README.md
CHANGED
@@ -5,15 +5,47 @@ tags:
|
|
5 |
- feature-extraction
|
6 |
- sentence-similarity
|
7 |
- transformers
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
---
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
|
14 |
|
15 |
<!--- Describe your model here -->
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
## Usage (Sentence-Transformers)
|
18 |
|
19 |
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
@@ -54,8 +86,8 @@ def mean_pooling(model_output, attention_mask):
|
|
54 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
55 |
|
56 |
# Load model from HuggingFace Hub
|
57 |
-
tokenizer = AutoTokenizer.from_pretrained('charlesdedampierre/bunka-
|
58 |
-
model = AutoModel.from_pretrained('charlesdedampierre/bunka-
|
59 |
|
60 |
# Tokenize sentences
|
61 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
@@ -77,43 +109,8 @@ print(sentence_embeddings)
|
|
77 |
|
78 |
<!--- Describe how your model was evaluated -->
|
79 |
|
80 |
-
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=charlesdedampierre/bunka-
|
81 |
-
|
82 |
|
83 |
-
## Training
|
84 |
-
The model was trained with the parameters:
|
85 |
-
|
86 |
-
**DataLoader**:
|
87 |
-
|
88 |
-
`torch.utils.data.dataloader.DataLoader` of length 3181 with parameters:
|
89 |
-
```
|
90 |
-
{'batch_size': 16, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
91 |
-
```
|
92 |
-
|
93 |
-
**Loss**:
|
94 |
-
|
95 |
-
`sentence_transformers.losses.TripletLoss.TripletLoss` with parameters:
|
96 |
-
```
|
97 |
-
{'distance_metric': 'TripletDistanceMetric.EUCLIDEAN', 'triplet_margin': 5}
|
98 |
-
```
|
99 |
-
|
100 |
-
Parameters of the fit()-Method:
|
101 |
-
```
|
102 |
-
{
|
103 |
-
"epochs": 5,
|
104 |
-
"evaluation_steps": 0,
|
105 |
-
"evaluator": "NoneType",
|
106 |
-
"max_grad_norm": 1,
|
107 |
-
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
|
108 |
-
"optimizer_params": {
|
109 |
-
"lr": 2e-05
|
110 |
-
},
|
111 |
-
"scheduler": "WarmupLinear",
|
112 |
-
"steps_per_epoch": null,
|
113 |
-
"warmup_steps": 1590,
|
114 |
-
"weight_decay": 0.01
|
115 |
-
}
|
116 |
-
```
|
117 |
|
118 |
|
119 |
## Full Model Architecture
|
|
|
5 |
- feature-extraction
|
6 |
- sentence-similarity
|
7 |
- transformers
|
8 |
+
datasets:
|
9 |
+
- embedding-data/QQP_triplets
|
10 |
+
language:
|
11 |
+
- en
|
12 |
+
license: mit
|
13 |
---
|
14 |
|
15 |
+
|
16 |
+
# charlesdedampierre/bunka-llms
|
17 |
|
18 |
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
|
19 |
|
20 |
<!--- Describe your model here -->
|
21 |
|
22 |
+
|
23 |
+
# Usage in Bunkatopics
|
24 |
+
|
25 |
+
You can use this LLM in the BunkaTopics package as following:
|
26 |
+
|
27 |
+
```
|
28 |
+
pip install bunkatopics
|
29 |
+
```
|
30 |
+
|
31 |
+
```python
|
32 |
+
from bunkatopics import Bunka
|
33 |
+
import random
|
34 |
+
from datasets import load_dataset
|
35 |
+
|
36 |
+
dataset = load_dataset("rguo123/trump_tweets")['train']['content']
|
37 |
+
full_docs = random.sample(dataset, 10000)
|
38 |
+
|
39 |
+
from langchain.embeddings import HuggingFaceEmbeddings
|
40 |
+
|
41 |
+
embedding_model = HuggingFaceEmbeddings(model_name="charlesdedampierre/bunka-embedding")
|
42 |
+
|
43 |
+
bunka = Bunka(model_hf=embedding_model)
|
44 |
+
|
45 |
+
bunka.fit(full_docs)
|
46 |
+
df_topics = bunka.get_topics(n_clusters = 20)
|
47 |
+
```
|
48 |
+
|
49 |
## Usage (Sentence-Transformers)
|
50 |
|
51 |
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
|
|
86 |
sentences = ['This is an example sentence', 'Each sentence is converted']
|
87 |
|
88 |
# Load model from HuggingFace Hub
|
89 |
+
tokenizer = AutoTokenizer.from_pretrained('charlesdedampierre/bunka-llms')
|
90 |
+
model = AutoModel.from_pretrained('charlesdedampierre/bunka-llms')
|
91 |
|
92 |
# Tokenize sentences
|
93 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
|
109 |
|
110 |
<!--- Describe how your model was evaluated -->
|
111 |
|
112 |
+
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=charlesdedampierre/bunka-llms)
|
|
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
|
116 |
## Full Model Architecture
|