Add new SentenceTransformer model
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +10 -0
- README.md +561 -0
- config.json +67 -0
- config_sentence_transformers.json +16 -0
- configuration_xlm_roberta.py +130 -0
- custom_st.py +229 -0
- model.safetensors +3 -0
- modules.json +23 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +51 -0
- tokenizer.json +3 -0
- tokenizer_config.json +62 -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,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 1024,
|
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 |
+
"pooling_mode_weightedmean_tokens": false,
|
8 |
+
"pooling_mode_lasttoken": false,
|
9 |
+
"include_prompt": true
|
10 |
+
}
|
README.md
ADDED
@@ -0,0 +1,561 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- sentence-transformers
|
4 |
+
- sentence-similarity
|
5 |
+
- feature-extraction
|
6 |
+
- generated_from_trainer
|
7 |
+
- dataset_size:584355
|
8 |
+
- loss:CachedInfonce
|
9 |
+
widget:
|
10 |
+
- source_sentence: What were the criticisms made by Joe Joseph and Thomas Sutcliffe
|
11 |
+
about the film
|
12 |
+
sentences:
|
13 |
+
- Heirloom quality! Shop Now For Chanukah!
|
14 |
+
- 'Charlie Rymer (born December 18, 1967) is an American professional golfer who
|
15 |
+
played on the PGA Tour and the Nike Tour. He is currently an analyst for the Golf
|
16 |
+
Channel. Amateur career
|
17 |
+
|
18 |
+
Rymer was born in Cleveland, Tennessee and grew up in Fort Mill, South Carolina.
|
19 |
+
Rymer played college golf at Georgia Tech, where he was a third-team All-American
|
20 |
+
in 1988 and an honorable mention All-American in 1989. He won five tournaments
|
21 |
+
during his time at Georgia Tech.'
|
22 |
+
- Joe Joseph of The Times agreed that the film was insubstantial, calling it a "speedy,
|
23 |
+
cost-efficient way to interleave stock library footage with quotes from DJs and
|
24 |
+
showbiz journalists in order to fill gaps in the late summer schedules." The Independents
|
25 |
+
Thomas Sutcliffe felt the airing of the film on the same week as the first anniversary
|
26 |
+
of the September 11 attacks was ill-timed, and described the film as "a scrappy
|
27 |
+
collage of warmed-over gossip and underpowered revelation."
|
28 |
+
- source_sentence: What is the expected impact on AT&T's networks if Apple releases
|
29 |
+
a WiFi-only model of the iPad
|
30 |
+
sentences:
|
31 |
+
- You don't have to take yourself too seriously, try to fit a mold, or fall into
|
32 |
+
the imitation trap. Your personal brand should look and feel like the best representation
|
33 |
+
of you.
|
34 |
+
- Add to that the fact that techies everywhere are either frothing or scoffing (with
|
35 |
+
a willingness to buy) at the iPad, and you're looking at yet another surge in
|
36 |
+
subscribers come March. Unless Apple releases the iPad without 3G support, as
|
37 |
+
may well be the case with the starting model priced at $499 and rumored to be
|
38 |
+
available only with WiFi, there will likely be hundreds of thousands of new 3G
|
39 |
+
devices added to AT&T's networks, and these devices are pretty data-heavy.
|
40 |
+
- He lives on Vashon Island with his wife, who is a teacher, and his teenage son
|
41 |
+
and daughter. They enjoy their gardens, walking, and spending vacations near water.
|
42 |
+
- source_sentence: When did Donald last see an office from the inside
|
43 |
+
sentences:
|
44 |
+
- 'Casso was endorsed by the Denver Post, but not the Rocky Mountain News. 2007
|
45 |
+
legislative session
|
46 |
+
|
47 |
+
In the 2007 session of the Colorado General Assembly, Casso sat on the House Education
|
48 |
+
Committee and the House State, Veterans, & Military Affairs Committee. During
|
49 |
+
the 2007 session, Casso sponsored two bills to revise the ways in which schools''
|
50 |
+
CSAP test scores were reported. One, which would have exempted scores from special
|
51 |
+
education students, was killed in a Senate committee; the other, which would have
|
52 |
+
exempted scores for students whose parents opt the students out of the test, was
|
53 |
+
killed in a House committee at Casso''s request because of concerns that it would
|
54 |
+
jeopardize federal school funding. Following the legislative session, Casso was
|
55 |
+
present at the Colorado State Capitol during an incident in which state troopers
|
56 |
+
shot and killed a mentally ill individual gunman targeting Gov. Bill Ritter. Casso
|
57 |
+
observed the dead body and afterwards supported increased security, including
|
58 |
+
metal detectors, for the state capitol building.'
|
59 |
+
- 'Donald saw the last time an office from the inside in 2006. Ever since did he
|
60 |
+
work online for himself in all different kind of coffee shops from Cambodia to
|
61 |
+
Tuvalu Islands. He started to get into serious trouble when AdWords Banned his
|
62 |
+
account of the blue. Oliver: Nice to meet you Donald, how are you'
|
63 |
+
- '- His Immortal Logness was magnificent
|
64 |
+
|
65 |
+
So bummed that I missed The Orb while touring the area. Thanks for the tribute
|
66 |
+
mix!'
|
67 |
+
- source_sentence: What percentage of tax revenues does corporate income tax revenue
|
68 |
+
currently account for in the U.S.
|
69 |
+
sentences:
|
70 |
+
- The fourth quarter unraveled at both ends, offensive stagnation leading to Houston
|
71 |
+
scoring chances that allowed the Rockets to set their defense and make the Pistons
|
72 |
+
attack in the half-court, where poor shooting from their backcourt - Rodney Stuckey
|
73 |
+
(1 of 10) and Brandon Knight combined to go 6 of 25 - made it difficult to spread
|
74 |
+
out Houston's defense. "I just think we lost our pace," Frank said.
|
75 |
+
- 'WELCOME TO KANEN INC.
|
76 |
+
|
77 |
+
AEROSPACE TOOL DESIGN
|
78 |
+
|
79 |
+
Kanen Inc. provides its services based on quality, customer satisfaction, and
|
80 |
+
a dedication to see your project succeed.'
|
81 |
+
- In his May 31 column (Abolish the Corporate Income Tax! ), he points out that
|
82 |
+
corporate income tax revenue has declined to 10% of tax revenues, despite the
|
83 |
+
U.S. having, by far, the highest corporate income tax rate in the world.
|
84 |
+
- source_sentence: What challenges does Mayor Hundred face in leading New York as
|
85 |
+
depicted in March to War
|
86 |
+
sentences:
|
87 |
+
- 'He retired in 2004. Honours
|
88 |
+
|
89 |
+
Morgan was appointed an Officer of the Order of the British Empire (OBE) in 2005.'
|
90 |
+
- Bring your sewing machine - scissors - material - pattern (if you already have
|
91 |
+
one that you want to work on) - have a project that you need assistance with -
|
92 |
+
just want to spend the day with your fellow Caerthen's in a day of sewing and
|
93 |
+
socializing? Come on out!
|
94 |
+
- His heroics convinced the citizens of New York to elect him mayor, and March to
|
95 |
+
War opens with Mayor Hundred dealing with unrest in the city. Political cartoons
|
96 |
+
display him as a caped superhero unable to handle the daily needs of the city,
|
97 |
+
and a protest against the war in Iraq has it divided.
|
98 |
+
pipeline_tag: sentence-similarity
|
99 |
+
library_name: sentence-transformers
|
100 |
+
---
|
101 |
+
|
102 |
+
# SentenceTransformer
|
103 |
+
|
104 |
+
This is a [sentence-transformers](https://www.SBERT.net) model trained. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
|
105 |
+
|
106 |
+
## Model Details
|
107 |
+
|
108 |
+
### Model Description
|
109 |
+
- **Model Type:** Sentence Transformer
|
110 |
+
<!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
|
111 |
+
- **Maximum Sequence Length:** 8192 tokens
|
112 |
+
- **Output Dimensionality:** 1024 dimensions
|
113 |
+
- **Similarity Function:** Cosine Similarity
|
114 |
+
<!-- - **Training Dataset:** Unknown -->
|
115 |
+
<!-- - **Language:** Unknown -->
|
116 |
+
<!-- - **License:** Unknown -->
|
117 |
+
|
118 |
+
### Model Sources
|
119 |
+
|
120 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
121 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
122 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
123 |
+
|
124 |
+
### Full Model Architecture
|
125 |
+
|
126 |
+
```
|
127 |
+
SentenceTransformer(
|
128 |
+
(transformer): Transformer(
|
129 |
+
(auto_model): XLMRobertaLoRA(
|
130 |
+
(roberta): XLMRobertaModel(
|
131 |
+
(embeddings): XLMRobertaEmbeddings(
|
132 |
+
(word_embeddings): ParametrizedEmbedding(
|
133 |
+
250002, 1024, padding_idx=1
|
134 |
+
(parametrizations): ModuleDict(
|
135 |
+
(weight): ParametrizationList(
|
136 |
+
(0): LoRAParametrization()
|
137 |
+
)
|
138 |
+
)
|
139 |
+
)
|
140 |
+
(token_type_embeddings): ParametrizedEmbedding(
|
141 |
+
1, 1024
|
142 |
+
(parametrizations): ModuleDict(
|
143 |
+
(weight): ParametrizationList(
|
144 |
+
(0): LoRAParametrization()
|
145 |
+
)
|
146 |
+
)
|
147 |
+
)
|
148 |
+
)
|
149 |
+
(emb_drop): Dropout(p=0.1, inplace=False)
|
150 |
+
(emb_ln): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
|
151 |
+
(encoder): XLMRobertaEncoder(
|
152 |
+
(layers): ModuleList(
|
153 |
+
(0-23): 24 x Block(
|
154 |
+
(mixer): MHA(
|
155 |
+
(rotary_emb): RotaryEmbedding()
|
156 |
+
(Wqkv): ParametrizedLinearResidual(
|
157 |
+
in_features=1024, out_features=3072, bias=True
|
158 |
+
(parametrizations): ModuleDict(
|
159 |
+
(weight): ParametrizationList(
|
160 |
+
(0): LoRAParametrization()
|
161 |
+
)
|
162 |
+
)
|
163 |
+
)
|
164 |
+
(inner_attn): FlashSelfAttention(
|
165 |
+
(drop): Dropout(p=0.1, inplace=False)
|
166 |
+
)
|
167 |
+
(inner_cross_attn): FlashCrossAttention(
|
168 |
+
(drop): Dropout(p=0.1, inplace=False)
|
169 |
+
)
|
170 |
+
(out_proj): ParametrizedLinear(
|
171 |
+
in_features=1024, out_features=1024, bias=True
|
172 |
+
(parametrizations): ModuleDict(
|
173 |
+
(weight): ParametrizationList(
|
174 |
+
(0): LoRAParametrization()
|
175 |
+
)
|
176 |
+
)
|
177 |
+
)
|
178 |
+
)
|
179 |
+
(dropout1): Dropout(p=0.1, inplace=False)
|
180 |
+
(drop_path1): StochasticDepth(p=0.0, mode=row)
|
181 |
+
(norm1): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
|
182 |
+
(mlp): Mlp(
|
183 |
+
(fc1): ParametrizedLinear(
|
184 |
+
in_features=1024, out_features=4096, bias=True
|
185 |
+
(parametrizations): ModuleDict(
|
186 |
+
(weight): ParametrizationList(
|
187 |
+
(0): LoRAParametrization()
|
188 |
+
)
|
189 |
+
)
|
190 |
+
)
|
191 |
+
(fc2): ParametrizedLinear(
|
192 |
+
in_features=4096, out_features=1024, bias=True
|
193 |
+
(parametrizations): ModuleDict(
|
194 |
+
(weight): ParametrizationList(
|
195 |
+
(0): LoRAParametrization()
|
196 |
+
)
|
197 |
+
)
|
198 |
+
)
|
199 |
+
)
|
200 |
+
(dropout2): Dropout(p=0.1, inplace=False)
|
201 |
+
(drop_path2): StochasticDepth(p=0.0, mode=row)
|
202 |
+
(norm2): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
|
203 |
+
)
|
204 |
+
)
|
205 |
+
)
|
206 |
+
(pooler): XLMRobertaPooler(
|
207 |
+
(dense): ParametrizedLinear(
|
208 |
+
in_features=1024, out_features=1024, bias=True
|
209 |
+
(parametrizations): ModuleDict(
|
210 |
+
(weight): ParametrizationList(
|
211 |
+
(0): LoRAParametrization()
|
212 |
+
)
|
213 |
+
)
|
214 |
+
)
|
215 |
+
(activation): Tanh()
|
216 |
+
)
|
217 |
+
)
|
218 |
+
)
|
219 |
+
)
|
220 |
+
(pooler): 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, 'include_prompt': True})
|
221 |
+
(normalizer): Normalize()
|
222 |
+
)
|
223 |
+
```
|
224 |
+
|
225 |
+
## Usage
|
226 |
+
|
227 |
+
### Direct Usage (Sentence Transformers)
|
228 |
+
|
229 |
+
First install the Sentence Transformers library:
|
230 |
+
|
231 |
+
```bash
|
232 |
+
pip install -U sentence-transformers
|
233 |
+
```
|
234 |
+
|
235 |
+
Then you can load this model and run inference.
|
236 |
+
```python
|
237 |
+
from sentence_transformers import SentenceTransformer
|
238 |
+
|
239 |
+
# Download from the 🤗 Hub
|
240 |
+
model = SentenceTransformer("Jrinky/jina3")
|
241 |
+
# Run inference
|
242 |
+
sentences = [
|
243 |
+
'What challenges does Mayor Hundred face in leading New York as depicted in March to War',
|
244 |
+
'His heroics convinced the citizens of New York to elect him mayor, and March to War opens with Mayor Hundred dealing with unrest in the city. Political cartoons display him as a caped superhero unable to handle the daily needs of the city, and a protest against the war in Iraq has it divided.',
|
245 |
+
"Bring your sewing machine - scissors - material - pattern (if you already have one that you want to work on) - have a project that you need assistance with - just want to spend the day with your fellow Caerthen's in a day of sewing and socializing? Come on out!",
|
246 |
+
]
|
247 |
+
embeddings = model.encode(sentences)
|
248 |
+
print(embeddings.shape)
|
249 |
+
# [3, 1024]
|
250 |
+
|
251 |
+
# Get the similarity scores for the embeddings
|
252 |
+
similarities = model.similarity(embeddings, embeddings)
|
253 |
+
print(similarities.shape)
|
254 |
+
# [3, 3]
|
255 |
+
```
|
256 |
+
|
257 |
+
<!--
|
258 |
+
### Direct Usage (Transformers)
|
259 |
+
|
260 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
261 |
+
|
262 |
+
</details>
|
263 |
+
-->
|
264 |
+
|
265 |
+
<!--
|
266 |
+
### Downstream Usage (Sentence Transformers)
|
267 |
+
|
268 |
+
You can finetune this model on your own dataset.
|
269 |
+
|
270 |
+
<details><summary>Click to expand</summary>
|
271 |
+
|
272 |
+
</details>
|
273 |
+
-->
|
274 |
+
|
275 |
+
<!--
|
276 |
+
### Out-of-Scope Use
|
277 |
+
|
278 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
279 |
+
-->
|
280 |
+
|
281 |
+
<!--
|
282 |
+
## Bias, Risks and Limitations
|
283 |
+
|
284 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
285 |
+
-->
|
286 |
+
|
287 |
+
<!--
|
288 |
+
### Recommendations
|
289 |
+
|
290 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
291 |
+
-->
|
292 |
+
|
293 |
+
## Training Details
|
294 |
+
|
295 |
+
### Training Dataset
|
296 |
+
|
297 |
+
#### Unnamed Dataset
|
298 |
+
|
299 |
+
* Size: 584,355 training samples
|
300 |
+
* Columns: <code>anchor</code> and <code>positive</code>
|
301 |
+
* Approximate statistics based on the first 1000 samples:
|
302 |
+
| | anchor | positive |
|
303 |
+
|:--------|:----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
|
304 |
+
| type | string | string |
|
305 |
+
| details | <ul><li>min: 6 tokens</li><li>mean: 17.41 tokens</li><li>max: 42 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 119.19 tokens</li><li>max: 1979 tokens</li></ul> |
|
306 |
+
* Samples:
|
307 |
+
| anchor | positive |
|
308 |
+
|:----------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
309 |
+
| <code>What resources and tools are recommended for busy brides planning their weddings</code> | <code>If you are planning on spending a little bit of time on your wedding planning, here is part 2 of my series of great resources and tools for wedding planning that every busy bride should know about. The previous instalment can be viewed here.</code> |
|
310 |
+
| <code>How many girls were raised in the house described</code> | <code>This house is where my parents proudly hung up our diplomas. This house is where 3 girls were raised.</code> |
|
311 |
+
| <code>Where did the narrator's dad always barbecue for Easter</code> | <code>This house is where my dad always barbequed for Easter, rain or shine. This house is where we welcomed family and friends on their first visit to the United States.</code> |
|
312 |
+
* Loss: <code>cachedselfloss2.CachedInfonce</code> with these parameters:
|
313 |
+
```json
|
314 |
+
{
|
315 |
+
"scale": 20.0,
|
316 |
+
"similarity_fct": "cos_sim"
|
317 |
+
}
|
318 |
+
```
|
319 |
+
|
320 |
+
### Evaluation Dataset
|
321 |
+
|
322 |
+
#### Unnamed Dataset
|
323 |
+
|
324 |
+
* Size: 18,073 evaluation samples
|
325 |
+
* Columns: <code>anchor</code> and <code>positive</code>
|
326 |
+
* Approximate statistics based on the first 1000 samples:
|
327 |
+
| | anchor | positive |
|
328 |
+
|:--------|:----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
|
329 |
+
| type | string | string |
|
330 |
+
| details | <ul><li>min: 6 tokens</li><li>mean: 17.52 tokens</li><li>max: 40 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 107.58 tokens</li><li>max: 1832 tokens</li></ul> |
|
331 |
+
* Samples:
|
332 |
+
| anchor | positive |
|
333 |
+
|:--------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
334 |
+
| <code>What significant role did the character Raven portray in early cinema</code> | <code>He played cynical tough guys in modern films, but then branched into westerns where for the most part he was the gallant hero. In fact the ultimate gallant white knight hero in Shane. His part as Raven is a difficult one, yet he pulls it off. He's a cold blooded contract killer, one of the earliest ever portrayed as a film protagonist. Yet he's human and you see flashes of it, his concern for cats. As a cat lover, I can sure identify with that. Raven is also one of the earliest characters in cinema who talks about child abuse making him what he is. Groundbreaking when you think about it. Next to Ladd, the biggest kudos have to go to Laird Cregar, borrowed from 20th Century Fox to play Willard Gates. Gates is a top company executive with Marshall's firm which is a defense contractor which is why the Senate is interested in him. He's basically a jerk who thinks he's so clever. Veronica Lake gets to him real easy because of his weakness for the nightclub scene.</code> |
|
335 |
+
| <code>What are the key features and characteristics of the Majestic Pure Dead Sea Mud Mask</code> | <code>At the same time, it can be used all over your body, not just face. This way, you can clear any part of your skin from its impurities. An additional feature that caught our eyes immediately was the beautifully designed packaging that makes this affordable product look high-end. The combination of grey, black, and blue colors will easily make it stand out in any beauty shop. - Good for sensitive and dry skin<br>- Affordable price<br>- Treats many different skin conditions<br>- Not good for oily skin<br>- Can feel a bit oily<br>Majestic Pure Dead Sea Mud Mask Review<br>Majestic Pure is a well-known brand among the beauty and skincare community. They make affordable, natural products and are oftentimes among the celebrity favorites.</code> |
|
336 |
+
| <code>What benefits does this product provide for the skin</code> | <code>This will provide you with softer skin that glows. At the same time, it will help you deal with your clogged pores and provide you the necessary daily acne treatment.</code> |
|
337 |
+
* Loss: <code>cachedselfloss2.CachedInfonce</code> with these parameters:
|
338 |
+
```json
|
339 |
+
{
|
340 |
+
"scale": 20.0,
|
341 |
+
"similarity_fct": "cos_sim"
|
342 |
+
}
|
343 |
+
```
|
344 |
+
|
345 |
+
### Training Hyperparameters
|
346 |
+
#### Non-Default Hyperparameters
|
347 |
+
|
348 |
+
- `eval_strategy`: steps
|
349 |
+
- `per_device_train_batch_size`: 800
|
350 |
+
- `per_device_eval_batch_size`: 800
|
351 |
+
- `learning_rate`: 2e-05
|
352 |
+
- `num_train_epochs`: 10
|
353 |
+
- `warmup_ratio`: 0.1
|
354 |
+
- `bf16`: True
|
355 |
+
- `batch_sampler`: no_duplicates
|
356 |
+
|
357 |
+
#### All Hyperparameters
|
358 |
+
<details><summary>Click to expand</summary>
|
359 |
+
|
360 |
+
- `overwrite_output_dir`: False
|
361 |
+
- `do_predict`: False
|
362 |
+
- `eval_strategy`: steps
|
363 |
+
- `prediction_loss_only`: True
|
364 |
+
- `per_device_train_batch_size`: 800
|
365 |
+
- `per_device_eval_batch_size`: 800
|
366 |
+
- `per_gpu_train_batch_size`: None
|
367 |
+
- `per_gpu_eval_batch_size`: None
|
368 |
+
- `gradient_accumulation_steps`: 1
|
369 |
+
- `eval_accumulation_steps`: None
|
370 |
+
- `torch_empty_cache_steps`: None
|
371 |
+
- `learning_rate`: 2e-05
|
372 |
+
- `weight_decay`: 0.0
|
373 |
+
- `adam_beta1`: 0.9
|
374 |
+
- `adam_beta2`: 0.999
|
375 |
+
- `adam_epsilon`: 1e-08
|
376 |
+
- `max_grad_norm`: 1.0
|
377 |
+
- `num_train_epochs`: 10
|
378 |
+
- `max_steps`: -1
|
379 |
+
- `lr_scheduler_type`: linear
|
380 |
+
- `lr_scheduler_kwargs`: {}
|
381 |
+
- `warmup_ratio`: 0.1
|
382 |
+
- `warmup_steps`: 0
|
383 |
+
- `log_level`: passive
|
384 |
+
- `log_level_replica`: warning
|
385 |
+
- `log_on_each_node`: True
|
386 |
+
- `logging_nan_inf_filter`: True
|
387 |
+
- `save_safetensors`: True
|
388 |
+
- `save_on_each_node`: False
|
389 |
+
- `save_only_model`: False
|
390 |
+
- `restore_callback_states_from_checkpoint`: False
|
391 |
+
- `no_cuda`: False
|
392 |
+
- `use_cpu`: False
|
393 |
+
- `use_mps_device`: False
|
394 |
+
- `seed`: 42
|
395 |
+
- `data_seed`: None
|
396 |
+
- `jit_mode_eval`: False
|
397 |
+
- `use_ipex`: False
|
398 |
+
- `bf16`: True
|
399 |
+
- `fp16`: False
|
400 |
+
- `fp16_opt_level`: O1
|
401 |
+
- `half_precision_backend`: auto
|
402 |
+
- `bf16_full_eval`: False
|
403 |
+
- `fp16_full_eval`: False
|
404 |
+
- `tf32`: None
|
405 |
+
- `local_rank`: 0
|
406 |
+
- `ddp_backend`: None
|
407 |
+
- `tpu_num_cores`: None
|
408 |
+
- `tpu_metrics_debug`: False
|
409 |
+
- `debug`: []
|
410 |
+
- `dataloader_drop_last`: False
|
411 |
+
- `dataloader_num_workers`: 0
|
412 |
+
- `dataloader_prefetch_factor`: None
|
413 |
+
- `past_index`: -1
|
414 |
+
- `disable_tqdm`: False
|
415 |
+
- `remove_unused_columns`: True
|
416 |
+
- `label_names`: None
|
417 |
+
- `load_best_model_at_end`: False
|
418 |
+
- `ignore_data_skip`: False
|
419 |
+
- `fsdp`: []
|
420 |
+
- `fsdp_min_num_params`: 0
|
421 |
+
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
422 |
+
- `fsdp_transformer_layer_cls_to_wrap`: None
|
423 |
+
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
424 |
+
- `deepspeed`: None
|
425 |
+
- `label_smoothing_factor`: 0.0
|
426 |
+
- `optim`: adamw_torch
|
427 |
+
- `optim_args`: None
|
428 |
+
- `adafactor`: False
|
429 |
+
- `group_by_length`: False
|
430 |
+
- `length_column_name`: length
|
431 |
+
- `ddp_find_unused_parameters`: None
|
432 |
+
- `ddp_bucket_cap_mb`: None
|
433 |
+
- `ddp_broadcast_buffers`: False
|
434 |
+
- `dataloader_pin_memory`: True
|
435 |
+
- `dataloader_persistent_workers`: False
|
436 |
+
- `skip_memory_metrics`: True
|
437 |
+
- `use_legacy_prediction_loop`: False
|
438 |
+
- `push_to_hub`: False
|
439 |
+
- `resume_from_checkpoint`: None
|
440 |
+
- `hub_model_id`: None
|
441 |
+
- `hub_strategy`: every_save
|
442 |
+
- `hub_private_repo`: None
|
443 |
+
- `hub_always_push`: False
|
444 |
+
- `gradient_checkpointing`: False
|
445 |
+
- `gradient_checkpointing_kwargs`: None
|
446 |
+
- `include_inputs_for_metrics`: False
|
447 |
+
- `include_for_metrics`: []
|
448 |
+
- `eval_do_concat_batches`: True
|
449 |
+
- `fp16_backend`: auto
|
450 |
+
- `push_to_hub_model_id`: None
|
451 |
+
- `push_to_hub_organization`: None
|
452 |
+
- `mp_parameters`:
|
453 |
+
- `auto_find_batch_size`: False
|
454 |
+
- `full_determinism`: False
|
455 |
+
- `torchdynamo`: None
|
456 |
+
- `ray_scope`: last
|
457 |
+
- `ddp_timeout`: 1800
|
458 |
+
- `torch_compile`: False
|
459 |
+
- `torch_compile_backend`: None
|
460 |
+
- `torch_compile_mode`: None
|
461 |
+
- `dispatch_batches`: None
|
462 |
+
- `split_batches`: None
|
463 |
+
- `include_tokens_per_second`: False
|
464 |
+
- `include_num_input_tokens_seen`: False
|
465 |
+
- `neftune_noise_alpha`: None
|
466 |
+
- `optim_target_modules`: None
|
467 |
+
- `batch_eval_metrics`: False
|
468 |
+
- `eval_on_start`: False
|
469 |
+
- `use_liger_kernel`: False
|
470 |
+
- `eval_use_gather_object`: False
|
471 |
+
- `average_tokens_across_devices`: False
|
472 |
+
- `prompts`: None
|
473 |
+
- `batch_sampler`: no_duplicates
|
474 |
+
- `multi_dataset_batch_sampler`: proportional
|
475 |
+
|
476 |
+
</details>
|
477 |
+
|
478 |
+
### Training Logs
|
479 |
+
| Epoch | Step | Training Loss | Validation Loss |
|
480 |
+
|:------:|:----:|:-------------:|:---------------:|
|
481 |
+
| 0.2052 | 150 | 13.7695 | 17.4625 |
|
482 |
+
| 0.4104 | 300 | 14.2067 | 17.4452 |
|
483 |
+
| 0.6156 | 450 | 14.344 | 17.4289 |
|
484 |
+
| 0.8208 | 600 | 13.705 | 17.3620 |
|
485 |
+
| 1.0260 | 750 | 13.0304 | 17.1246 |
|
486 |
+
| 1.2312 | 900 | 13.28 | 16.7495 |
|
487 |
+
| 1.4364 | 1050 | 13.0314 | 16.5068 |
|
488 |
+
| 1.6416 | 1200 | 13.0861 | 16.3113 |
|
489 |
+
| 1.8468 | 1350 | 13.2752 | 16.1406 |
|
490 |
+
| 2.0520 | 1500 | 12.2868 | 16.0122 |
|
491 |
+
| 2.2572 | 1650 | 12.9551 | 15.9320 |
|
492 |
+
| 2.4624 | 1800 | 12.8339 | 15.8444 |
|
493 |
+
| 2.6676 | 1950 | 12.0719 | 15.8108 |
|
494 |
+
| 2.8728 | 2100 | 12.7803 | 15.7694 |
|
495 |
+
| 3.0780 | 2250 | 11.9023 | 15.7460 |
|
496 |
+
| 3.2832 | 2400 | 12.6882 | 15.7291 |
|
497 |
+
| 3.4884 | 2550 | 12.3062 | 15.7165 |
|
498 |
+
| 3.6936 | 2700 | 12.402 | 15.7071 |
|
499 |
+
| 3.8988 | 2850 | 12.0136 | 15.7014 |
|
500 |
+
| 4.1040 | 3000 | 12.821 | 15.6873 |
|
501 |
+
| 4.3092 | 3150 | 12.4667 | 15.6835 |
|
502 |
+
| 4.5144 | 3300 | 12.6469 | 15.6740 |
|
503 |
+
| 4.7196 | 3450 | 12.1751 | 15.6519 |
|
504 |
+
| 4.9248 | 3600 | 12.3627 | 15.6637 |
|
505 |
+
|
506 |
+
|
507 |
+
### Framework Versions
|
508 |
+
- Python: 3.10.14
|
509 |
+
- Sentence Transformers: 3.4.1
|
510 |
+
- Transformers: 4.49.0
|
511 |
+
- PyTorch: 2.3.1+cu121
|
512 |
+
- Accelerate: 1.5.2
|
513 |
+
- Datasets: 3.4.1
|
514 |
+
- Tokenizers: 0.21.1
|
515 |
+
|
516 |
+
## Citation
|
517 |
+
|
518 |
+
### BibTeX
|
519 |
+
|
520 |
+
#### Sentence Transformers
|
521 |
+
```bibtex
|
522 |
+
@inproceedings{reimers-2019-sentence-bert,
|
523 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
524 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
525 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
526 |
+
month = "11",
|
527 |
+
year = "2019",
|
528 |
+
publisher = "Association for Computational Linguistics",
|
529 |
+
url = "https://arxiv.org/abs/1908.10084",
|
530 |
+
}
|
531 |
+
```
|
532 |
+
|
533 |
+
#### CachedInfonce
|
534 |
+
```bibtex
|
535 |
+
@misc{gao2021scaling,
|
536 |
+
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
|
537 |
+
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
|
538 |
+
year={2021},
|
539 |
+
eprint={2101.06983},
|
540 |
+
archivePrefix={arXiv},
|
541 |
+
primaryClass={cs.LG}
|
542 |
+
}
|
543 |
+
```
|
544 |
+
|
545 |
+
<!--
|
546 |
+
## Glossary
|
547 |
+
|
548 |
+
*Clearly define terms in order to be accessible across audiences.*
|
549 |
+
-->
|
550 |
+
|
551 |
+
<!--
|
552 |
+
## Model Card Authors
|
553 |
+
|
554 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
555 |
+
-->
|
556 |
+
|
557 |
+
<!--
|
558 |
+
## Model Card Contact
|
559 |
+
|
560 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
561 |
+
-->
|
config.json
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/root/lanyun-tmp/models/jina/checkpoint-3600",
|
3 |
+
"architectures": [
|
4 |
+
"XLMRobertaLoRA"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "configuration_xlm_roberta.XLMRobertaFlashConfig",
|
9 |
+
"AutoModel": "jinaai/xlm-roberta-flash-implementation--modeling_lora.XLMRobertaLoRA",
|
10 |
+
"AutoModelForMaskedLM": "jinaai/xlm-roberta-flash-implementation--modeling_xlm_roberta.XLMRobertaForMaskedLM",
|
11 |
+
"AutoModelForPreTraining": "jinaai/xlm-roberta-flash-implementation--modeling_xlm_roberta.XLMRobertaForPreTraining"
|
12 |
+
},
|
13 |
+
"bos_token_id": 0,
|
14 |
+
"classifier_dropout": null,
|
15 |
+
"emb_pooler": null,
|
16 |
+
"eos_token_id": 2,
|
17 |
+
"hidden_act": "gelu",
|
18 |
+
"hidden_dropout_prob": 0.1,
|
19 |
+
"hidden_size": 1024,
|
20 |
+
"initializer_range": 0.02,
|
21 |
+
"intermediate_size": 4096,
|
22 |
+
"layer_norm_eps": 1e-05,
|
23 |
+
"load_trained_adapters": true,
|
24 |
+
"lora_adaptations": [
|
25 |
+
"retrieval.query",
|
26 |
+
"retrieval.passage",
|
27 |
+
"separation",
|
28 |
+
"classification",
|
29 |
+
"text-matching"
|
30 |
+
],
|
31 |
+
"lora_alpha": 1,
|
32 |
+
"lora_dropout_p": 0.0,
|
33 |
+
"lora_main_params_trainable": false,
|
34 |
+
"lora_rank": 4,
|
35 |
+
"matryoshka_dimensions": [
|
36 |
+
32,
|
37 |
+
64,
|
38 |
+
128,
|
39 |
+
256,
|
40 |
+
512,
|
41 |
+
768,
|
42 |
+
1024
|
43 |
+
],
|
44 |
+
"max_position_embeddings": 8194,
|
45 |
+
"model_type": "xlm-roberta",
|
46 |
+
"num_attention_heads": 16,
|
47 |
+
"num_hidden_layers": 24,
|
48 |
+
"output_past": true,
|
49 |
+
"pad_token_id": 1,
|
50 |
+
"position_embedding_type": "rotary",
|
51 |
+
"rotary_emb_base": 20000.0,
|
52 |
+
"task_instructions": {
|
53 |
+
"classification": "",
|
54 |
+
"retrieval.passage": "Represent the document for retrieval: ",
|
55 |
+
"retrieval.query": "Represent the query for retrieving evidence documents: ",
|
56 |
+
"separation": "",
|
57 |
+
"text-matching": ""
|
58 |
+
},
|
59 |
+
"torch_dtype": "bfloat16",
|
60 |
+
"transformers_version": "4.49.0",
|
61 |
+
"truncate_dim": null,
|
62 |
+
"type_vocab_size": 1,
|
63 |
+
"use_cache": true,
|
64 |
+
"use_flash_attn": true,
|
65 |
+
"use_reentrant": false,
|
66 |
+
"vocab_size": 250002
|
67 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "3.4.1",
|
4 |
+
"transformers": "4.49.0",
|
5 |
+
"pytorch": "2.3.1+cu121"
|
6 |
+
},
|
7 |
+
"prompts": {
|
8 |
+
"retrieval.query": "Represent the query for retrieving evidence documents: ",
|
9 |
+
"retrieval.passage": "Represent the document for retrieval: ",
|
10 |
+
"separation": "",
|
11 |
+
"classification": "",
|
12 |
+
"text-matching": ""
|
13 |
+
},
|
14 |
+
"default_prompt_name": null,
|
15 |
+
"similarity_fn_name": "cosine"
|
16 |
+
}
|
configuration_xlm_roberta.py
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any, Dict, List, Optional, Union
|
2 |
+
|
3 |
+
import torch
|
4 |
+
from transformers import PretrainedConfig
|
5 |
+
|
6 |
+
|
7 |
+
class XLMRobertaFlashConfig(PretrainedConfig):
|
8 |
+
|
9 |
+
model_type = "xlm-roberta"
|
10 |
+
|
11 |
+
def __init__(
|
12 |
+
self,
|
13 |
+
vocab_size: int = 250002,
|
14 |
+
hidden_size: int = 1024,
|
15 |
+
num_hidden_layers: int = 24,
|
16 |
+
num_attention_heads: int = 16,
|
17 |
+
intermediate_size: int = 4096,
|
18 |
+
hidden_act: str = "gelu",
|
19 |
+
hidden_dropout_prob: float = 0.1,
|
20 |
+
attention_probs_dropout_prob: float = 0.1,
|
21 |
+
max_position_embeddings: int = 8194,
|
22 |
+
type_vocab_size: int = 1,
|
23 |
+
initializer_range: float = 0.02,
|
24 |
+
layer_norm_eps: float = 1e-05,
|
25 |
+
pad_token_id: int = 1,
|
26 |
+
bos_token_id: int = 0,
|
27 |
+
eos_token_id: int = 2,
|
28 |
+
position_embedding_type: str = "rotary",
|
29 |
+
rotary_emb_base: float = 10000.0,
|
30 |
+
use_cache: bool = True,
|
31 |
+
use_reentrant: bool = False,
|
32 |
+
classifier_dropout: Optional[float] = None,
|
33 |
+
lora_adaptations: Optional[List[str]] = None,
|
34 |
+
task_instructions: Optional[Dict[str, str]] = None,
|
35 |
+
lora_rank: int = 4,
|
36 |
+
lora_dropout_p: float = 0.0,
|
37 |
+
lora_alpha: int = 1,
|
38 |
+
lora_main_params_trainable: bool = False,
|
39 |
+
load_trained_adapters: bool = False,
|
40 |
+
use_flash_attn: bool = True,
|
41 |
+
torch_dtype: Optional[Union[str, torch.dtype]] = None,
|
42 |
+
emb_pooler: Optional[str] = None,
|
43 |
+
matryoshka_dimensions: Optional[List[int]] = None,
|
44 |
+
truncate_dim: Optional[int] = None,
|
45 |
+
**kwargs: Dict[str, Any],
|
46 |
+
):
|
47 |
+
"""
|
48 |
+
Initialize the XLMRobertaFlashConfig configuration.
|
49 |
+
|
50 |
+
Args:
|
51 |
+
vocab_size (int): Size of the vocabulary.
|
52 |
+
hidden_size (int): Dimensionality of the encoder layers and the pooler layer.
|
53 |
+
num_hidden_layers (int): Number of hidden layers in the Transformer encoder.
|
54 |
+
num_attention_heads (int): Number of attention heads for each attention layer in the Transformer encoder.
|
55 |
+
intermediate_size (int): Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer.
|
56 |
+
hidden_act (str): The activation function to use.
|
57 |
+
hidden_dropout_prob (float): The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
58 |
+
attention_probs_dropout_prob (float): The dropout ratio for the attention probabilities.
|
59 |
+
max_position_embeddings (int): The maximum length of the position embeddings.
|
60 |
+
type_vocab_size (int): The vocabulary size of the token type ids.
|
61 |
+
initializer_range (float): The standard deviation for initializing all weight matrices.
|
62 |
+
layer_norm_eps (float): The epsilon used by the layer normalization layers.
|
63 |
+
pad_token_id (int): The ID of the padding token.
|
64 |
+
bos_token_id (int): The ID of the beginning-of-sequence token.
|
65 |
+
eos_token_id (int): The ID of the end-of-sequence token.
|
66 |
+
position_embedding_type (str): Type of position embeddings. Options are 'absolute', 'alibi', or 'rotary'.
|
67 |
+
rotary_emb_base (float): Base for rotary embeddings.
|
68 |
+
use_cache (bool): Whether or not the model should return the last key/values attentions (not used by all models).
|
69 |
+
use_reentrant (bool): Whether or not the model should enable the 'use_reentrant' flag in gradient checkpointing.
|
70 |
+
classifier_dropout (Optional[float]): The dropout ratio for the classification head.
|
71 |
+
lora_adaptations (Optional[List[str]]): LoRA adaptations configuration.
|
72 |
+
lora_prompts (Optional[Dict[str, str]]): LoRA prompts configuration.
|
73 |
+
lora_rank (int): Rank for LoRA adaptations.
|
74 |
+
lora_dropout_p (float): Dropout probability for LoRA adaptations.
|
75 |
+
lora_alpha (int): Alpha parameter for LoRA.
|
76 |
+
lora_main_params_trainable (bool): Whether to make the main model parameters trainable when using LoRA.
|
77 |
+
load_trained_adapters (bool): Whether to load trained adapters.
|
78 |
+
use_flash_attn (bool): Whether to use FlashAttention.
|
79 |
+
torch_dtype (Optional[Union[str, torch.dtype]]): Data type for the tensors.
|
80 |
+
emb_pooler (Optional[str]): Pooling layer configuration.
|
81 |
+
matryoshka_dimensions (Optional[List[int]]): Configuration for matryoshka dimension reduction.
|
82 |
+
truncate_dim (Optional[int]): Dimension to truncate embeddings to, if any.
|
83 |
+
**kwargs (Dict[str, Any]): Additional keyword arguments passed to the configuration.
|
84 |
+
"""
|
85 |
+
|
86 |
+
super().__init__(
|
87 |
+
pad_token_id=pad_token_id,
|
88 |
+
bos_token_id=bos_token_id,
|
89 |
+
eos_token_id=eos_token_id,
|
90 |
+
**kwargs,
|
91 |
+
)
|
92 |
+
|
93 |
+
self.vocab_size = vocab_size
|
94 |
+
self.hidden_size = hidden_size
|
95 |
+
self.num_hidden_layers = num_hidden_layers
|
96 |
+
self.num_attention_heads = num_attention_heads
|
97 |
+
self.hidden_act = hidden_act
|
98 |
+
self.intermediate_size = intermediate_size
|
99 |
+
self.hidden_dropout_prob = hidden_dropout_prob
|
100 |
+
self.attention_probs_dropout_prob = attention_probs_dropout_prob
|
101 |
+
self.max_position_embeddings = max_position_embeddings
|
102 |
+
self.type_vocab_size = type_vocab_size
|
103 |
+
self.initializer_range = initializer_range
|
104 |
+
self.layer_norm_eps = layer_norm_eps
|
105 |
+
self.position_embedding_type = position_embedding_type
|
106 |
+
self.rotary_emb_base = rotary_emb_base
|
107 |
+
self.use_cache = use_cache
|
108 |
+
self.use_reentrant = use_reentrant
|
109 |
+
self.classifier_dropout = classifier_dropout
|
110 |
+
self.load_trained_adapters = load_trained_adapters
|
111 |
+
self.lora_adaptations = lora_adaptations
|
112 |
+
self.task_instructions = task_instructions
|
113 |
+
self.lora_rank = lora_rank
|
114 |
+
self.lora_dropout_p = lora_dropout_p
|
115 |
+
self.lora_alpha = lora_alpha
|
116 |
+
self.lora_main_params_trainable = lora_main_params_trainable
|
117 |
+
self.use_flash_attn = use_flash_attn
|
118 |
+
self.emb_pooler = emb_pooler
|
119 |
+
self.matryoshka_dimensions = matryoshka_dimensions
|
120 |
+
self.truncate_dim = truncate_dim
|
121 |
+
if (
|
122 |
+
torch_dtype
|
123 |
+
and hasattr(torch, torch_dtype)
|
124 |
+
and type(getattr(torch, torch_dtype)) is torch.dtype
|
125 |
+
):
|
126 |
+
self.torch_dtype = getattr(torch, torch_dtype)
|
127 |
+
else:
|
128 |
+
self.torch_dtype = torch_dtype
|
129 |
+
if not self.use_flash_attn or not torch.cuda.is_available():
|
130 |
+
self.torch_dtype = torch.float32
|
custom_st.py
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import logging
|
3 |
+
import os
|
4 |
+
from io import BytesIO
|
5 |
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
6 |
+
|
7 |
+
import torch
|
8 |
+
from torch import nn
|
9 |
+
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
10 |
+
|
11 |
+
logger = logging.getLogger(__name__)
|
12 |
+
|
13 |
+
|
14 |
+
class Transformer(nn.Module):
|
15 |
+
"""Huggingface AutoModel to generate token embeddings.
|
16 |
+
Loads the correct class, e.g. BERT / RoBERTa etc.
|
17 |
+
|
18 |
+
Args:
|
19 |
+
model_name_or_path: Huggingface models name
|
20 |
+
(https://huggingface.co/models)
|
21 |
+
max_seq_length: Truncate any inputs longer than max_seq_length
|
22 |
+
model_args: Keyword arguments passed to the Huggingface
|
23 |
+
Transformers model
|
24 |
+
tokenizer_args: Keyword arguments passed to the Huggingface
|
25 |
+
Transformers tokenizer
|
26 |
+
config_args: Keyword arguments passed to the Huggingface
|
27 |
+
Transformers config
|
28 |
+
cache_dir: Cache dir for Huggingface Transformers to store/load
|
29 |
+
models
|
30 |
+
do_lower_case: If true, lowercases the input (independent if the
|
31 |
+
model is cased or not)
|
32 |
+
tokenizer_name_or_path: Name or path of the tokenizer. When
|
33 |
+
None, then model_name_or_path is used
|
34 |
+
"""
|
35 |
+
|
36 |
+
save_in_root: bool = True
|
37 |
+
|
38 |
+
def __init__(
|
39 |
+
self,
|
40 |
+
model_name_or_path: str,
|
41 |
+
max_seq_length: int = None,
|
42 |
+
model_args: Dict[str, Any] = None,
|
43 |
+
tokenizer_args: Dict[str, Any] = None,
|
44 |
+
config_args: Dict[str, Any] = None,
|
45 |
+
cache_dir: str = None,
|
46 |
+
do_lower_case: bool = False,
|
47 |
+
tokenizer_name_or_path: str = None,
|
48 |
+
**kwargs,
|
49 |
+
) -> None:
|
50 |
+
super().__init__()
|
51 |
+
self.config_keys = ["max_seq_length", "do_lower_case"]
|
52 |
+
self.do_lower_case = do_lower_case
|
53 |
+
if model_args is None:
|
54 |
+
model_args = {}
|
55 |
+
if tokenizer_args is None:
|
56 |
+
tokenizer_args = {}
|
57 |
+
if config_args is None:
|
58 |
+
config_args = {}
|
59 |
+
|
60 |
+
if kwargs.get("backend", "torch") != "torch":
|
61 |
+
logger.warning(
|
62 |
+
f'"jinaai/jina-embeddings-v3" is currently not compatible with the {kwargs["backend"]} backend. '
|
63 |
+
'Continuing with the "torch" backend.'
|
64 |
+
)
|
65 |
+
|
66 |
+
self.config = AutoConfig.from_pretrained(model_name_or_path, **config_args, cache_dir=cache_dir)
|
67 |
+
|
68 |
+
self._lora_adaptations = self.config.lora_adaptations
|
69 |
+
if (
|
70 |
+
not isinstance(self._lora_adaptations, list)
|
71 |
+
or len(self._lora_adaptations) < 1
|
72 |
+
):
|
73 |
+
raise ValueError(
|
74 |
+
f"`lora_adaptations` must be a list and contain at least one element"
|
75 |
+
)
|
76 |
+
self._adaptation_map = {
|
77 |
+
name: idx for idx, name in enumerate(self._lora_adaptations)
|
78 |
+
}
|
79 |
+
|
80 |
+
self.default_task = model_args.pop('default_task', None)
|
81 |
+
|
82 |
+
self.auto_model = AutoModel.from_pretrained(model_name_or_path, config=self.config, cache_dir=cache_dir, **model_args)
|
83 |
+
|
84 |
+
if max_seq_length is not None and "model_max_length" not in tokenizer_args:
|
85 |
+
tokenizer_args["model_max_length"] = max_seq_length
|
86 |
+
self.tokenizer = AutoTokenizer.from_pretrained(
|
87 |
+
tokenizer_name_or_path if tokenizer_name_or_path is not None else model_name_or_path,
|
88 |
+
cache_dir=cache_dir,
|
89 |
+
**tokenizer_args,
|
90 |
+
)
|
91 |
+
|
92 |
+
# No max_seq_length set. Try to infer from model
|
93 |
+
if max_seq_length is None:
|
94 |
+
if (
|
95 |
+
hasattr(self.auto_model, "config")
|
96 |
+
and hasattr(self.auto_model.config, "max_position_embeddings")
|
97 |
+
and hasattr(self.tokenizer, "model_max_length")
|
98 |
+
):
|
99 |
+
max_seq_length = min(self.auto_model.config.max_position_embeddings, self.tokenizer.model_max_length)
|
100 |
+
|
101 |
+
self.max_seq_length = max_seq_length
|
102 |
+
|
103 |
+
if tokenizer_name_or_path is not None:
|
104 |
+
self.auto_model.config.tokenizer_class = self.tokenizer.__class__.__name__
|
105 |
+
|
106 |
+
|
107 |
+
@property
|
108 |
+
def default_task(self):
|
109 |
+
return self._default_task
|
110 |
+
|
111 |
+
@default_task.setter
|
112 |
+
def default_task(self, task: Union[None, str]):
|
113 |
+
self._validate_task(task)
|
114 |
+
self._default_task = task
|
115 |
+
|
116 |
+
|
117 |
+
def _validate_task(self, task: str):
|
118 |
+
if task and task not in self._lora_adaptations:
|
119 |
+
raise ValueError(
|
120 |
+
f"Unsupported task '{task}'. "
|
121 |
+
f"Supported tasks are: {', '.join(self.config.lora_adaptations)}. "
|
122 |
+
f"Alternatively, don't pass the `task` argument to disable LoRA."
|
123 |
+
)
|
124 |
+
|
125 |
+
def forward(
|
126 |
+
self, features: Dict[str, torch.Tensor], task: Optional[str] = None
|
127 |
+
) -> Dict[str, torch.Tensor]:
|
128 |
+
"""Returns token_embeddings, cls_token"""
|
129 |
+
self._validate_task(task)
|
130 |
+
task = task or self.default_task
|
131 |
+
adapter_mask = None
|
132 |
+
if task:
|
133 |
+
task_id = self._adaptation_map[task]
|
134 |
+
num_examples = features['input_ids'].size(0)
|
135 |
+
adapter_mask = torch.full(
|
136 |
+
(num_examples,), task_id, dtype=torch.int32, device=features['input_ids'].device
|
137 |
+
)
|
138 |
+
|
139 |
+
lora_arguments = (
|
140 |
+
{"adapter_mask": adapter_mask} if adapter_mask is not None else {}
|
141 |
+
)
|
142 |
+
features.pop('prompt_length', None)
|
143 |
+
output_states = self.auto_model.forward(**features, **lora_arguments, return_dict=False)
|
144 |
+
output_tokens = output_states[0]
|
145 |
+
features.update({"token_embeddings": output_tokens, "attention_mask": features["attention_mask"]})
|
146 |
+
return features
|
147 |
+
|
148 |
+
def get_word_embedding_dimension(self) -> int:
|
149 |
+
return self.auto_model.config.hidden_size
|
150 |
+
|
151 |
+
def tokenize(
|
152 |
+
self,
|
153 |
+
texts: Union[List[str], List[dict], List[Tuple[str, str]]],
|
154 |
+
padding: Union[str, bool] = True
|
155 |
+
) -> Dict[str, torch.Tensor]:
|
156 |
+
"""Tokenizes a text and maps tokens to token-ids"""
|
157 |
+
output = {}
|
158 |
+
if isinstance(texts[0], str):
|
159 |
+
to_tokenize = [texts]
|
160 |
+
elif isinstance(texts[0], dict):
|
161 |
+
to_tokenize = []
|
162 |
+
output["text_keys"] = []
|
163 |
+
for lookup in texts:
|
164 |
+
text_key, text = next(iter(lookup.items()))
|
165 |
+
to_tokenize.append(text)
|
166 |
+
output["text_keys"].append(text_key)
|
167 |
+
to_tokenize = [to_tokenize]
|
168 |
+
else:
|
169 |
+
batch1, batch2 = [], []
|
170 |
+
for text_tuple in texts:
|
171 |
+
batch1.append(text_tuple[0])
|
172 |
+
batch2.append(text_tuple[1])
|
173 |
+
to_tokenize = [batch1, batch2]
|
174 |
+
|
175 |
+
# strip
|
176 |
+
to_tokenize = [[str(s).strip() for s in col] for col in to_tokenize]
|
177 |
+
|
178 |
+
# Lowercase
|
179 |
+
if self.do_lower_case:
|
180 |
+
to_tokenize = [[s.lower() for s in col] for col in to_tokenize]
|
181 |
+
|
182 |
+
output.update(
|
183 |
+
self.tokenizer(
|
184 |
+
*to_tokenize,
|
185 |
+
padding=padding,
|
186 |
+
truncation="longest_first",
|
187 |
+
return_tensors="pt",
|
188 |
+
max_length=self.max_seq_length,
|
189 |
+
)
|
190 |
+
)
|
191 |
+
return output
|
192 |
+
|
193 |
+
def get_config_dict(self) -> Dict[str, Any]:
|
194 |
+
return {key: self.__dict__[key] for key in self.config_keys}
|
195 |
+
|
196 |
+
def save(self, output_path: str, safe_serialization: bool = True) -> None:
|
197 |
+
self.auto_model.save_pretrained(output_path, safe_serialization=safe_serialization)
|
198 |
+
self.tokenizer.save_pretrained(output_path)
|
199 |
+
|
200 |
+
with open(os.path.join(output_path, "sentence_bert_config.json"), "w") as fOut:
|
201 |
+
json.dump(self.get_config_dict(), fOut, indent=2)
|
202 |
+
|
203 |
+
|
204 |
+
@classmethod
|
205 |
+
def load(cls, input_path: str) -> "Transformer":
|
206 |
+
# Old classes used other config names than 'sentence_bert_config.json'
|
207 |
+
for config_name in [
|
208 |
+
"sentence_bert_config.json",
|
209 |
+
"sentence_roberta_config.json",
|
210 |
+
"sentence_distilbert_config.json",
|
211 |
+
"sentence_camembert_config.json",
|
212 |
+
"sentence_albert_config.json",
|
213 |
+
"sentence_xlm-roberta_config.json",
|
214 |
+
"sentence_xlnet_config.json",
|
215 |
+
]:
|
216 |
+
sbert_config_path = os.path.join(input_path, config_name)
|
217 |
+
if os.path.exists(sbert_config_path):
|
218 |
+
break
|
219 |
+
|
220 |
+
with open(sbert_config_path) as fIn:
|
221 |
+
config = json.load(fIn)
|
222 |
+
# Don't allow configs to set trust_remote_code
|
223 |
+
if "model_args" in config and "trust_remote_code" in config["model_args"]:
|
224 |
+
config["model_args"].pop("trust_remote_code")
|
225 |
+
if "tokenizer_args" in config and "trust_remote_code" in config["tokenizer_args"]:
|
226 |
+
config["tokenizer_args"].pop("trust_remote_code")
|
227 |
+
if "config_args" in config and "trust_remote_code" in config["config_args"]:
|
228 |
+
config["config_args"].pop("trust_remote_code")
|
229 |
+
return cls(model_name_or_path=input_path, **config)
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b90d9267b4e08a66532b8c71c76a799d63f432b14abc501bd1d65d551543538a
|
3 |
+
size 1144685320
|
modules.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"idx": 0,
|
4 |
+
"name": "transformer",
|
5 |
+
"path": "",
|
6 |
+
"type": "custom_st.Transformer",
|
7 |
+
"kwargs": [
|
8 |
+
"task"
|
9 |
+
]
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"idx": 1,
|
13 |
+
"name": "pooler",
|
14 |
+
"path": "1_Pooling",
|
15 |
+
"type": "sentence_transformers.models.Pooling"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"idx": 2,
|
19 |
+
"name": "normalizer",
|
20 |
+
"path": "2_Normalize",
|
21 |
+
"type": "sentence_transformers.models.Normalize"
|
22 |
+
}
|
23 |
+
]
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 8192,
|
3 |
+
"do_lower_case": false
|
4 |
+
}
|
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:aa7a6ad87a7ce8fe196787355f6af7d03aee94d19c54a5eb1392ed18c8ef451a
|
3 |
+
size 17082988
|
tokenizer_config.json
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"extra_special_tokens": {},
|
49 |
+
"mask_token": "<mask>",
|
50 |
+
"max_length": 8192,
|
51 |
+
"model_max_length": 8192,
|
52 |
+
"pad_to_multiple_of": null,
|
53 |
+
"pad_token": "<pad>",
|
54 |
+
"pad_token_type_id": 0,
|
55 |
+
"padding_side": "right",
|
56 |
+
"sep_token": "</s>",
|
57 |
+
"stride": 0,
|
58 |
+
"tokenizer_class": "XLMRobertaTokenizerFast",
|
59 |
+
"truncation_side": "right",
|
60 |
+
"truncation_strategy": "longest_first",
|
61 |
+
"unk_token": "<unk>"
|
62 |
+
}
|