strauss-oak commited on
Commit
b931244
1 Parent(s): b62135b

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  ctfidf_config.json filter=lfs diff=lfs merge=lfs -text
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  ctfidf_config.json filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": true,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false
7
+ }
README.md CHANGED
@@ -1,89 +1,163 @@
1
-
2
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  tags:
4
- - bertopic
5
- library_name: bertopic
6
- pipeline_tag: text-classification
 
7
  ---
8
 
9
- # mdl_bertopic_globo
 
 
10
 
11
- This is a [BERTopic](https://github.com/MaartenGr/BERTopic) model.
12
- BERTopic is a flexible and modular topic modeling framework that allows for the generation of easily interpretable topics from large datasets.
13
 
14
- ## Usage
15
 
16
- To use this model, please install BERTopic:
 
 
17
 
18
  ```
19
- pip install -U bertopic
20
  ```
21
 
22
- You can use the model as follows:
23
 
24
  ```python
25
- from bertopic import BERTopic
26
- topic_model = BERTopic.load("strauss-oak/mdl_bertopic_globo")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- topic_model.get_topic_info()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ```
30
 
31
- ## Topic overview
32
-
33
- * Number of topics: 20
34
- * Number of training documents: 24433
35
-
36
- <details>
37
- <summary>Click here for an overview of all topics.</summary>
38
-
39
- | Topic ID | Topic Keywords | Topic Frequency | Label |
40
- |----------|----------------|-----------------|-------|
41
- | -1 | disse - anos - presidente - ainda - pessoas | 13 | -1_disse_anos_presidente_ainda |
42
- | 0 | dose - saude - covid - vacina - casos | 7995 | 0_dose_saude_covid_vacina |
43
- | 1 | presidente - bolsonaro - governo - disse - lula | 3785 | 1_presidente_bolsonaro_governo_disse |
44
- | 2 | policia - disse - local - policiais - anos | 3626 | 2_policia_disse_local_policiais |
45
- | 3 | anos - musica - brasil - gente - vai | 2170 | 3_anos_musica_brasil_gente |
46
- | 4 | ucrania - russia - guerra - putin - disse | 1616 | 4_ucrania_russia_guerra_putin |
47
- | 5 | chuva - sul - feira - chuvas - energia | 690 | 5_chuva_sul_feira_chuvas |
48
- | 6 | preco - precos - produto - petrobras - combustiveis | 619 | 6_preco_precos_produto_petrobras |
49
- | 7 | hospital - anos - familia - paulo - disse | 617 | 7_hospital_anos_familia_paulo |
50
- | 8 | inflacao - juros - alta - taxa - economia | 501 | 8_inflacao_juros_alta_taxa |
51
- | 9 | dezenas - aposta - premio - probabilidade - caixa | 378 | 9_dezenas_aposta_premio_probabilidade |
52
- | 10 | voo - aeronave - aviao - voos - aeroporto | 370 | 10_voo_aeronave_aviao_voos |
53
- | 11 | internet - iphone - rede - facebook - usuarios | 360 | 11_internet_iphone_rede_facebook |
54
- | 12 | valor - pagamento - declaracao - valores - imposto | 342 | 12_valor_pagamento_declaracao_valores |
55
- | 13 | fase - manifestantes - servicos - funcionar - paulo | 336 | 13_fase_manifestantes_servicos_funcionar |
56
- | 14 | desmatamento - amazonia - indigenas - emissoes - brasil | 333 | 14_desmatamento_amazonia_indigenas_emissoes |
57
- | 15 | taliba - israel - afeganistao - hamas - gaza | 327 | 15_taliba_israel_afeganistao_hamas |
58
- | 16 | trabalho - trimestre - milhoes - trabalhadores - pessoas | 167 | 16_trabalho_trimestre_milhoes_trabalhadores |
59
- | 17 | pessoas - genero - trans - racismo - lgbtqia | 97 | 17_pessoas_genero_trans_racismo |
60
- | 18 | licenca - paternidade - licenca paternidade - piangers - ovulos | 91 | 18_licenca_paternidade_licenca paternidade_piangers |
61
-
62
- </details>
63
-
64
- ## Training hyperparameters
65
-
66
- * calculate_probabilities: False
67
- * language: None
68
- * low_memory: False
69
- * min_topic_size: 10
70
- * n_gram_range: (1, 1)
71
- * nr_topics: 20
72
- * seed_topic_list: None
73
- * top_n_words: 10
74
- * verbose: False
75
- * zeroshot_min_similarity: 0.7
76
- * zeroshot_topic_list: None
77
-
78
- ## Framework versions
79
-
80
- * Numpy: 1.23.5
81
- * HDBSCAN: 0.8.33
82
- * UMAP: 0.5.5
83
- * Pandas: 1.5.3
84
- * Scikit-Learn: 1.2.2
85
- * Sentence-transformers: 2.2.2
86
- * Transformers: 4.35.2
87
- * Numba: 0.58.1
88
- * Plotly: 5.15.0
89
- * Python: 3.10.12
 
 
1
  ---
2
+ language:
3
+ - multilingual
4
+ - ar
5
+ - bg
6
+ - ca
7
+ - cs
8
+ - da
9
+ - de
10
+ - el
11
+ - en
12
+ - es
13
+ - et
14
+ - fa
15
+ - fi
16
+ - fr
17
+ - gl
18
+ - gu
19
+ - he
20
+ - hi
21
+ - hr
22
+ - hu
23
+ - hy
24
+ - id
25
+ - it
26
+ - ja
27
+ - ka
28
+ - ko
29
+ - ku
30
+ - lt
31
+ - lv
32
+ - mk
33
+ - mn
34
+ - mr
35
+ - ms
36
+ - my
37
+ - nb
38
+ - nl
39
+ - pl
40
+ - pt
41
+ - ro
42
+ - ru
43
+ - sk
44
+ - sl
45
+ - sq
46
+ - sr
47
+ - sv
48
+ - th
49
+ - tr
50
+ - uk
51
+ - ur
52
+ - vi
53
+ language_bcp47:
54
+ - fr-ca
55
+ - pt-br
56
+ - zh-cn
57
+ - zh-tw
58
+ pipeline_tag: sentence-similarity
59
+ license: apache-2.0
60
  tags:
61
+ - sentence-transformers
62
+ - feature-extraction
63
+ - sentence-similarity
64
+ - transformers
65
  ---
66
 
67
+ # sentence-transformers/paraphrase-multilingual-mpnet-base-v2
68
+
69
+ 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.
70
 
 
 
71
 
 
72
 
73
+ ## Usage (Sentence-Transformers)
74
+
75
+ Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
76
 
77
  ```
78
+ pip install -U sentence-transformers
79
  ```
80
 
81
+ Then you can use the model like this:
82
 
83
  ```python
84
+ from sentence_transformers import SentenceTransformer
85
+ sentences = ["This is an example sentence", "Each sentence is converted"]
86
+
87
+ model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-mpnet-base-v2')
88
+ embeddings = model.encode(sentences)
89
+ print(embeddings)
90
+ ```
91
+
92
+
93
+
94
+ ## Usage (HuggingFace Transformers)
95
+ 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.
96
+
97
+ ```python
98
+ from transformers import AutoTokenizer, AutoModel
99
+ import torch
100
+
101
+
102
+ #Mean Pooling - Take attention mask into account for correct averaging
103
+ def mean_pooling(model_output, attention_mask):
104
+ token_embeddings = model_output[0] #First element of model_output contains all token embeddings
105
+ input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
106
+ return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
107
+
108
+
109
+ # Sentences we want sentence embeddings for
110
+ sentences = ['This is an example sentence', 'Each sentence is converted']
111
+
112
+ # Load model from HuggingFace Hub
113
+ tokenizer = AutoTokenizer.from_pretrained('sentence-transformers/paraphrase-multilingual-mpnet-base-v2')
114
+ model = AutoModel.from_pretrained('sentence-transformers/paraphrase-multilingual-mpnet-base-v2')
115
 
116
+ # Tokenize sentences
117
+ encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
118
+
119
+ # Compute token embeddings
120
+ with torch.no_grad():
121
+ model_output = model(**encoded_input)
122
+
123
+ # Perform pooling. In this case, average pooling
124
+ sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
125
+
126
+ print("Sentence embeddings:")
127
+ print(sentence_embeddings)
128
+ ```
129
+
130
+
131
+
132
+ ## Evaluation Results
133
+
134
+
135
+
136
+ For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=sentence-transformers/paraphrase-multilingual-mpnet-base-v2)
137
+
138
+
139
+
140
+ ## Full Model Architecture
141
+ ```
142
+ SentenceTransformer(
143
+ (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
144
+ (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
145
+ )
146
  ```
147
 
148
+ ## Citing & Authors
149
+
150
+ This model was trained by [sentence-transformers](https://www.sbert.net/).
151
+
152
+ If you find this model helpful, feel free to cite our publication [Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks](https://arxiv.org/abs/1908.10084):
153
+ ```bibtex
154
+ @inproceedings{reimers-2019-sentence-bert,
155
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
156
+ author = "Reimers, Nils and Gurevych, Iryna",
157
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
158
+ month = "11",
159
+ year = "2019",
160
+ publisher = "Association for Computational Linguistics",
161
+ url = "http://arxiv.org/abs/1908.10084",
162
+ }
163
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
config.json CHANGED
@@ -1,16 +1,29 @@
1
  {
2
- "calculate_probabilities": false,
3
- "language": null,
4
- "low_memory": false,
5
- "min_topic_size": 10,
6
- "n_gram_range": [
7
- 1,
8
- 1
9
  ],
10
- "nr_topics": 20,
11
- "seed_topic_list": null,
12
- "top_n_words": 10,
13
- "verbose": false,
14
- "zeroshot_min_similarity": 0.7,
15
- "zeroshot_topic_list": null
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  {
2
+ "_name_or_path": "/root/.cache/torch/sentence_transformers/sentence-transformers_paraphrase-multilingual-mpnet-base-v2/",
3
+ "architectures": [
4
+ "XLMRobertaModel"
 
 
 
 
5
  ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-05,
17
+ "max_position_embeddings": 514,
18
+ "model_type": "xlm-roberta",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "output_past": true,
22
+ "pad_token_id": 1,
23
+ "position_embedding_type": "absolute",
24
+ "torch_dtype": "float32",
25
+ "transformers_version": "4.35.2",
26
+ "type_vocab_size": 1,
27
+ "use_cache": true,
28
+ "vocab_size": 250002
29
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.0.0",
4
+ "transformers": "4.7.0",
5
+ "pytorch": "1.9.0+cu102"
6
+ }
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2eb113e32dd129f5fbfd09b1accdb069d27305d7a570a7c60460a750bb53193d
3
+ size 1112197096
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ }
14
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 128,
3
+ "do_lower_case": false
4
+ }
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
3
+ size 5069051
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa685fc160bbdbab64058d4fc91b60e62d207e8dc60b9af5c002c5ab946ded00
3
+ size 17083009
tokenizer_config.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "mask_token": "<mask>",
49
+ "max_length": 128,
50
+ "model_max_length": 512,
51
+ "pad_to_multiple_of": null,
52
+ "pad_token": "<pad>",
53
+ "pad_token_type_id": 0,
54
+ "padding_side": "right",
55
+ "sep_token": "</s>",
56
+ "stride": 0,
57
+ "tokenizer_class": "XLMRobertaTokenizer",
58
+ "truncation_side": "right",
59
+ "truncation_strategy": "longest_first",
60
+ "unk_token": "<unk>"
61
+ }