Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +9 -0
- config.json +40 -0
- config_sentence_transformers.json +7 -0
- configuration_bge_m3.py +52 -0
- model.safetensors +3 -0
- modeling_bge_m3.py +201 -0
- modules.json +20 -0
- sentence_bert_config.json +4 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +51 -0
- tokenizer.json +3 -0
- tokenizer_config.json +55 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip 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
|
|
|
|
33 |
*.zip 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 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
1_Pooling/config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 1024,
|
3 |
+
"pooling_mode_cls_token": true,
|
4 |
+
"pooling_mode_mean_tokens": false,
|
5 |
+
"pooling_mode_max_tokens": false,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
7 |
+
"pooling_mode_weightedmean_tokens": false,
|
8 |
+
"pooling_mode_lasttoken": false
|
9 |
+
}
|
config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "./export_bge_m3",
|
3 |
+
"architectures": [
|
4 |
+
"BgeM3Model"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "configuration_bge_m3.BgeM3Config",
|
9 |
+
"AutoModel": "modeling_bge_m3.BgeM3Model"
|
10 |
+
},
|
11 |
+
"bos_token_id": 0,
|
12 |
+
"classifier_dropout": null,
|
13 |
+
"colbert_dim": null,
|
14 |
+
"eos_token_id": 2,
|
15 |
+
"hidden_act": "gelu",
|
16 |
+
"hidden_dropout_prob": 0.1,
|
17 |
+
"hidden_size": 1024,
|
18 |
+
"initializer_range": 0.02,
|
19 |
+
"intermediate_size": 4096,
|
20 |
+
"layer_norm_eps": 1e-05,
|
21 |
+
"max_position_embeddings": 8194,
|
22 |
+
"model_type": "bge-m3",
|
23 |
+
"num_attention_heads": 16,
|
24 |
+
"num_hidden_layers": 24,
|
25 |
+
"output_past": true,
|
26 |
+
"pad_token_id": 1,
|
27 |
+
"position_embedding_type": "absolute",
|
28 |
+
"sentence_pooling_method": "cls",
|
29 |
+
"torch_dtype": "float32",
|
30 |
+
"transformers_version": "4.37.2",
|
31 |
+
"type_vocab_size": 1,
|
32 |
+
"unused_tokens": [
|
33 |
+
0,
|
34 |
+
2,
|
35 |
+
1,
|
36 |
+
3
|
37 |
+
],
|
38 |
+
"use_cache": true,
|
39 |
+
"vocab_size": 250002
|
40 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "2.3.1",
|
4 |
+
"transformers": "4.37.2",
|
5 |
+
"pytorch": "2.2.0a0+81ea7a4"
|
6 |
+
}
|
7 |
+
}
|
configuration_bge_m3.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers.configuration_utils import PretrainedConfig
|
2 |
+
|
3 |
+
|
4 |
+
# Copied from transformers.models.xlm_roberta.configuration_xlm_roberta.XLMRobertaConfig with XLMRoberta->BgeM3
|
5 |
+
class BgeM3Config(PretrainedConfig):
|
6 |
+
model_type = "bge-m3"
|
7 |
+
|
8 |
+
def __init__(
|
9 |
+
self,
|
10 |
+
vocab_size=30522,
|
11 |
+
hidden_size=768,
|
12 |
+
num_hidden_layers=12,
|
13 |
+
num_attention_heads=12,
|
14 |
+
intermediate_size=3072,
|
15 |
+
hidden_act="gelu",
|
16 |
+
hidden_dropout_prob=0.1,
|
17 |
+
attention_probs_dropout_prob=0.1,
|
18 |
+
max_position_embeddings=512,
|
19 |
+
type_vocab_size=2,
|
20 |
+
initializer_range=0.02,
|
21 |
+
layer_norm_eps=1e-12,
|
22 |
+
pad_token_id=1,
|
23 |
+
bos_token_id=0,
|
24 |
+
eos_token_id=2,
|
25 |
+
position_embedding_type="absolute",
|
26 |
+
use_cache=True,
|
27 |
+
classifier_dropout=None,
|
28 |
+
colbert_dim=None,
|
29 |
+
sentence_pooling_method='cls',
|
30 |
+
unused_tokens=None,
|
31 |
+
**kwargs,
|
32 |
+
):
|
33 |
+
super().__init__(pad_token_id=pad_token_id, bos_token_id=bos_token_id, eos_token_id=eos_token_id, **kwargs)
|
34 |
+
|
35 |
+
self.vocab_size = vocab_size
|
36 |
+
self.hidden_size = hidden_size
|
37 |
+
self.num_hidden_layers = num_hidden_layers
|
38 |
+
self.num_attention_heads = num_attention_heads
|
39 |
+
self.hidden_act = hidden_act
|
40 |
+
self.intermediate_size = intermediate_size
|
41 |
+
self.hidden_dropout_prob = hidden_dropout_prob
|
42 |
+
self.attention_probs_dropout_prob = attention_probs_dropout_prob
|
43 |
+
self.max_position_embeddings = max_position_embeddings
|
44 |
+
self.type_vocab_size = type_vocab_size
|
45 |
+
self.initializer_range = initializer_range
|
46 |
+
self.layer_norm_eps = layer_norm_eps
|
47 |
+
self.position_embedding_type = position_embedding_type
|
48 |
+
self.use_cache = use_cache
|
49 |
+
self.classifier_dropout = classifier_dropout
|
50 |
+
self.colbert_dim = colbert_dim
|
51 |
+
self.sentence_pooling_method = sentence_pooling_method
|
52 |
+
self.unused_tokens = unused_tokens
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4cfba41811196728d7604ac67da00fd749beeba0e6557eb685620898a032f1eb
|
3 |
+
size 2271071852
|
modeling_bge_m3.py
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from collections import defaultdict
|
2 |
+
from dataclasses import dataclass
|
3 |
+
from typing import Dict, List, Optional, Tuple, Union
|
4 |
+
|
5 |
+
import torch
|
6 |
+
from torch import nn
|
7 |
+
from transformers.modeling_outputs import BaseModelOutputWithPoolingAndCrossAttentions, ModelOutput
|
8 |
+
from transformers.models.xlm_roberta import (
|
9 |
+
XLMRobertaModel,
|
10 |
+
XLMRobertaPreTrainedModel,
|
11 |
+
)
|
12 |
+
|
13 |
+
from .configuration_bge_m3 import BgeM3Config
|
14 |
+
|
15 |
+
|
16 |
+
@dataclass
|
17 |
+
class BgeM3ModelOutput(ModelOutput):
|
18 |
+
last_hidden_state: torch.FloatTensor = None
|
19 |
+
pooler_output: torch.FloatTensor = None
|
20 |
+
dense_output: torch.FloatTensor = None
|
21 |
+
colbert_output: Optional[List[torch.FloatTensor]] = None
|
22 |
+
sparse_output: Optional[Dict[int, float]] = None
|
23 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]] = None
|
24 |
+
past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
|
25 |
+
attentions: Optional[Tuple[torch.FloatTensor]] = None
|
26 |
+
cross_attentions: Optional[Tuple[torch.FloatTensor]] = None
|
27 |
+
|
28 |
+
|
29 |
+
class BgeM3Model(XLMRobertaPreTrainedModel):
|
30 |
+
config_class = BgeM3Config
|
31 |
+
|
32 |
+
def __init__(self, config: BgeM3Config):
|
33 |
+
super().__init__(config)
|
34 |
+
self.roberta = XLMRobertaModel(config, add_pooling_layer=False)
|
35 |
+
# TODO: Check the dtype of these linear layers
|
36 |
+
self.colbert_linear = nn.Linear(
|
37 |
+
in_features=config.hidden_size,
|
38 |
+
out_features=config.hidden_size if config.colbert_dim is None else config.colbert_dim,
|
39 |
+
)
|
40 |
+
self.sparse_linear = nn.Linear(in_features=config.hidden_size, out_features=1)
|
41 |
+
self.sentence_pooling_method = config.sentence_pooling_method
|
42 |
+
|
43 |
+
self.init_weights()
|
44 |
+
|
45 |
+
def dense_embedding(self, hidden_state, mask):
|
46 |
+
if self.sentence_pooling_method == "cls":
|
47 |
+
return hidden_state[:, 0]
|
48 |
+
elif self.sentence_pooling_method == "mean":
|
49 |
+
s = torch.sum(hidden_state * mask.unsqueeze(-1).float(), dim=1)
|
50 |
+
d = mask.sum(axis=1, keepdim=True).float()
|
51 |
+
return s / d
|
52 |
+
|
53 |
+
def sparse_embedding(self, hidden_state, input_ids, return_embedding: bool = False):
|
54 |
+
token_weights = torch.relu(self.sparse_linear(hidden_state))
|
55 |
+
if not return_embedding:
|
56 |
+
return token_weights
|
57 |
+
|
58 |
+
sparse_embedding = torch.zeros(
|
59 |
+
input_ids.size(0),
|
60 |
+
input_ids.size(1),
|
61 |
+
self.config.vocab_size,
|
62 |
+
dtype=token_weights.dtype,
|
63 |
+
device=token_weights.device,
|
64 |
+
)
|
65 |
+
sparse_embedding = torch.scatter(sparse_embedding, dim=-1, index=input_ids.unsqueeze(-1), src=token_weights)
|
66 |
+
|
67 |
+
unused_tokens = self.config.unused_tokens
|
68 |
+
sparse_embedding = torch.max(sparse_embedding, dim=1).values
|
69 |
+
sparse_embedding[:, unused_tokens] *= 0.0
|
70 |
+
return sparse_embedding
|
71 |
+
|
72 |
+
def colbert_embedding(self, last_hidden_state, mask):
|
73 |
+
colbert_vecs = self.colbert_linear(last_hidden_state[:, 1:])
|
74 |
+
colbert_vecs = colbert_vecs * mask[:, 1:][:, :, None].float()
|
75 |
+
return colbert_vecs
|
76 |
+
|
77 |
+
def _process_token_weights(self, token_weights, input_ids, mask):
|
78 |
+
token_weights = token_weights.squeeze(-1)
|
79 |
+
# conver to dict
|
80 |
+
all_result = []
|
81 |
+
unused_tokens = self.config.unused_tokens
|
82 |
+
unused_tokens = torch.tensor(unused_tokens, device=input_ids.device)
|
83 |
+
|
84 |
+
# 获取有效的 token 的索引
|
85 |
+
valid_indices = ~torch.isin(input_ids, unused_tokens)
|
86 |
+
# weight必须大于0
|
87 |
+
valid_indices = (valid_indices & (token_weights > 0)).bool()
|
88 |
+
# 结合 attention mask,获取有效的 token 的索引
|
89 |
+
valid_indices = (valid_indices & mask).bool()
|
90 |
+
|
91 |
+
for i, valid in enumerate(valid_indices):
|
92 |
+
result = defaultdict(int)
|
93 |
+
|
94 |
+
# 获取有效的 weights 和 ids
|
95 |
+
valid_weights = token_weights[i][valid]
|
96 |
+
valid_ids = input_ids[i][valid]
|
97 |
+
|
98 |
+
# 获取每个 id 的最大权重
|
99 |
+
unique_ids, inverse_indices = torch.unique(valid_ids, return_inverse=True)
|
100 |
+
|
101 |
+
# 使用一个循环来找到每个 unique id 的最大权重
|
102 |
+
for i in range(unique_ids.shape[0]):
|
103 |
+
id_mask = inverse_indices == i
|
104 |
+
result[str(unique_ids[i].item())] = valid_weights[id_mask].max().item()
|
105 |
+
|
106 |
+
all_result.append(result)
|
107 |
+
# token_weights = np.ceil(token_weights * 100)
|
108 |
+
# for w, idx, num in zip(token_weights, input_ids, tokens_num):
|
109 |
+
# r = defaultdict(int)
|
110 |
+
# token_weight = w[:num]
|
111 |
+
# idx = idx[:num]
|
112 |
+
|
113 |
+
# for t_w, t_idx in zip(token_weight, idx):
|
114 |
+
# if t_idx.item() not in unused_tokens:
|
115 |
+
# t_idx = str(t_idx.item())
|
116 |
+
# if t_w > r[t_idx]:
|
117 |
+
# r[t_idx] = t_w.item()
|
118 |
+
|
119 |
+
# result.append(r)
|
120 |
+
|
121 |
+
# if idx not in unused_tokens and w > 0:
|
122 |
+
# idx = str(idx)
|
123 |
+
# # w = int(w)
|
124 |
+
# if w > result[idx]:
|
125 |
+
# result[idx] = w
|
126 |
+
return all_result
|
127 |
+
|
128 |
+
def _process_colbert_vecs(self, colbert_vecs, tokens_num) -> List[torch.Tensor]:
|
129 |
+
# delte the vectors of padding tokens
|
130 |
+
vecs = []
|
131 |
+
for i in range(len(tokens_num)):
|
132 |
+
vecs.append(colbert_vecs[i, : tokens_num[i] - 1])
|
133 |
+
return vecs
|
134 |
+
|
135 |
+
# Copied from transformers.models.bert.modeling_bert.BertModel.forward
|
136 |
+
def forward(
|
137 |
+
self,
|
138 |
+
input_ids: Optional[torch.Tensor] = None,
|
139 |
+
attention_mask: Optional[torch.Tensor] = None,
|
140 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
141 |
+
position_ids: Optional[torch.Tensor] = None,
|
142 |
+
head_mask: Optional[torch.Tensor] = None,
|
143 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
144 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
145 |
+
encoder_attention_mask: Optional[torch.Tensor] = None,
|
146 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
147 |
+
use_cache: Optional[bool] = None,
|
148 |
+
output_attentions: Optional[bool] = None,
|
149 |
+
output_hidden_states: Optional[bool] = None,
|
150 |
+
return_dict: Optional[bool] = None,
|
151 |
+
) -> Union[Tuple[torch.Tensor], BgeM3ModelOutput]:
|
152 |
+
roberta_output: BaseModelOutputWithPoolingAndCrossAttentions = self.roberta(
|
153 |
+
input_ids,
|
154 |
+
attention_mask=attention_mask,
|
155 |
+
token_type_ids=token_type_ids,
|
156 |
+
position_ids=position_ids,
|
157 |
+
head_mask=head_mask,
|
158 |
+
inputs_embeds=inputs_embeds,
|
159 |
+
encoder_hidden_states=encoder_hidden_states,
|
160 |
+
encoder_attention_mask=encoder_attention_mask,
|
161 |
+
past_key_values=past_key_values,
|
162 |
+
use_cache=use_cache,
|
163 |
+
output_attentions=output_attentions,
|
164 |
+
output_hidden_states=output_hidden_states,
|
165 |
+
return_dict=True,
|
166 |
+
)
|
167 |
+
|
168 |
+
last_hidden_state = roberta_output.last_hidden_state
|
169 |
+
dense_output = self.dense_embedding(last_hidden_state, attention_mask)
|
170 |
+
|
171 |
+
tokens_num = attention_mask.sum(dim=1)
|
172 |
+
colbert_output = self.colbert_embedding(last_hidden_state, attention_mask)
|
173 |
+
colbert_output = self._process_colbert_vecs(colbert_output, tokens_num)
|
174 |
+
|
175 |
+
sparse_output = self.sparse_embedding(last_hidden_state, input_ids)
|
176 |
+
sparse_output = self._process_token_weights(sparse_output, input_ids, attention_mask)
|
177 |
+
|
178 |
+
if not return_dict:
|
179 |
+
return (
|
180 |
+
last_hidden_state,
|
181 |
+
roberta_output.pooler_output,
|
182 |
+
dense_output,
|
183 |
+
colbert_output,
|
184 |
+
sparse_output,
|
185 |
+
roberta_output.hidden_states,
|
186 |
+
roberta_output.past_key_values,
|
187 |
+
roberta_output.attentions,
|
188 |
+
roberta_output.cross_attentions,
|
189 |
+
)
|
190 |
+
|
191 |
+
return BgeM3ModelOutput(
|
192 |
+
last_hidden_state=last_hidden_state,
|
193 |
+
dense_output=dense_output,
|
194 |
+
pooler_output=roberta_output.pooler_output,
|
195 |
+
colbert_output=colbert_output,
|
196 |
+
sparse_output=sparse_output,
|
197 |
+
hidden_states=roberta_output.hidden_states,
|
198 |
+
past_key_values=roberta_output.past_key_values,
|
199 |
+
attentions=roberta_output.attentions,
|
200 |
+
cross_attentions=roberta_output.cross_attentions,
|
201 |
+
)
|
modules.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
{
|
15 |
+
"idx": 2,
|
16 |
+
"name": "2",
|
17 |
+
"path": "2_Normalize",
|
18 |
+
"type": "sentence_transformers.models.Normalize"
|
19 |
+
}
|
20 |
+
]
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 8192,
|
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,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"cls_token": {
|
10 |
+
"content": "<s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"eos_token": {
|
17 |
+
"content": "</s>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"mask_token": {
|
24 |
+
"content": "<mask>",
|
25 |
+
"lstrip": true,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"pad_token": {
|
31 |
+
"content": "<pad>",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false
|
36 |
+
},
|
37 |
+
"sep_token": {
|
38 |
+
"content": "</s>",
|
39 |
+
"lstrip": false,
|
40 |
+
"normalized": false,
|
41 |
+
"rstrip": false,
|
42 |
+
"single_word": false
|
43 |
+
},
|
44 |
+
"unk_token": {
|
45 |
+
"content": "<unk>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"single_word": false
|
50 |
+
}
|
51 |
+
}
|
tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6710678b12670bc442b99edc952c4d996ae309a7020c1fa0096dd245c2faf790
|
3 |
+
size 17082821
|
tokenizer_config.json
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"model_max_length": 8192,
|
50 |
+
"pad_token": "<pad>",
|
51 |
+
"sep_token": "</s>",
|
52 |
+
"sp_model_kwargs": {},
|
53 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
54 |
+
"unk_token": "<unk>"
|
55 |
+
}
|