colabbear commited on
Commit
96a5939
·
verified ·
1 Parent(s): 8985b52

Upload folder using huggingface_hub

Browse files
.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
README.md ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - BAAI/bge-reranker-v2-m3
4
+ license: apache-2.0
5
+ pipeline_tag: text-classification
6
+ tags:
7
+ - bnb-my-repo
8
+ - transformers
9
+ - sentence-transformers
10
+ - text-embeddings-inference
11
+ language:
12
+ - multilingual
13
+ ---
14
+ # BAAI/bge-reranker-v2-m3 (Quantized)
15
+
16
+ ## Description
17
+ This model is a quantized version of the original model [`BAAI/bge-reranker-v2-m3`](https://huggingface.co/BAAI/bge-reranker-v2-m3).
18
+
19
+ It's quantized using the BitsAndBytes library to 4-bit using the [bnb-my-repo](https://huggingface.co/spaces/bnb-community/bnb-my-repo) space.
20
+
21
+ ## Quantization Details
22
+ - **Quantization Type**: int4
23
+ - **bnb_4bit_quant_type**: nf4
24
+ - **bnb_4bit_use_double_quant**: True
25
+ - **bnb_4bit_compute_dtype**: bfloat16
26
+ - **bnb_4bit_quant_storage**: uint8
27
+
28
+
29
+
30
+ # 📄 Original Model Information
31
+
32
+
33
+
34
+ # Reranker
35
+
36
+ **More details please refer to our Github: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding/tree/master).**
37
+
38
+ - [Model List](#model-list)
39
+ - [Usage](#usage)
40
+ - [Fine-tuning](#fine-tune)
41
+ - [Evaluation](#evaluation)
42
+ - [Citation](#citation)
43
+
44
+ Different from embedding model, reranker uses question and document as input and directly output similarity instead of embedding.
45
+ You can get a relevance score by inputting query and passage to the reranker.
46
+ And the score can be mapped to a float value in [0,1] by sigmoid function.
47
+
48
+
49
+ ## Model List
50
+
51
+ | Model | Base model | Language | layerwise | feature |
52
+ |:--------------------------------------------------------------------------|:--------:|:-----------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------:|
53
+ | [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) | [xlm-roberta-base](https://huggingface.co/xlm-roberta-base) | Chinese and English | - | Lightweight reranker model, easy to deploy, with fast inference. |
54
+ | [BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) | [xlm-roberta-large](https://huggingface.co/FacebookAI/xlm-roberta-large) | Chinese and English | - | Lightweight reranker model, easy to deploy, with fast inference. |
55
+ | [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) | [bge-m3](https://huggingface.co/BAAI/bge-m3) | Multilingual | - | Lightweight reranker model, possesses strong multilingual capabilities, easy to deploy, with fast inference. |
56
+ | [BAAI/bge-reranker-v2-gemma](https://huggingface.co/BAAI/bge-reranker-v2-gemma) | [gemma-2b](https://huggingface.co/google/gemma-2b) | Multilingual | - | Suitable for multilingual contexts, performs well in both English proficiency and multilingual capabilities. |
57
+ | [BAAI/bge-reranker-v2-minicpm-layerwise](https://huggingface.co/BAAI/bge-reranker-v2-minicpm-layerwise) | [MiniCPM-2B-dpo-bf16](https://huggingface.co/openbmb/MiniCPM-2B-dpo-bf16) | Multilingual | 8-40 | Suitable for multilingual contexts, performs well in both English and Chinese proficiency, allows freedom to select layers for output, facilitating accelerated inference. |
58
+
59
+
60
+ You can select the model according your senario and resource.
61
+ - For **multilingual**, utilize [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) and [BAAI/bge-reranker-v2-gemma](https://huggingface.co/BAAI/bge-reranker-v2-gemma)
62
+
63
+ - For **Chinese or English**, utilize [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) and [BAAI/bge-reranker-v2-minicpm-layerwise](https://huggingface.co/BAAI/bge-reranker-v2-minicpm-layerwise).
64
+
65
+ - For **efficiency**, utilize [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) and the low layer of [BAAI/bge-reranker-v2-minicpm-layerwise](https://huggingface.co/BAAI/bge-reranker-v2-minicpm-layerwise).
66
+
67
+ - For better performance, recommand [BAAI/bge-reranker-v2-minicpm-layerwise](https://huggingface.co/BAAI/bge-reranker-v2-minicpm-layerwise) and [BAAI/bge-reranker-v2-gemma](https://huggingface.co/BAAI/bge-reranker-v2-gemma)
68
+
69
+ ## Usage
70
+ ### Using FlagEmbedding
71
+
72
+ ```
73
+ pip install -U FlagEmbedding
74
+ ```
75
+
76
+ #### For normal reranker (bge-reranker-base / bge-reranker-large / bge-reranker-v2-m3 )
77
+
78
+ Get relevance scores (higher scores indicate more relevance):
79
+
80
+ ```python
81
+ from FlagEmbedding import FlagReranker
82
+ reranker = FlagReranker('BAAI/bge-reranker-v2-m3', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
83
+
84
+ score = reranker.compute_score(['query', 'passage'])
85
+ print(score) # -5.65234375
86
+
87
+ # You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
88
+ score = reranker.compute_score(['query', 'passage'], normalize=True)
89
+ print(score) # 0.003497010252573502
90
+
91
+ scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']])
92
+ print(scores) # [-8.1875, 5.26171875]
93
+
94
+ # You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
95
+ scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']], normalize=True)
96
+ print(scores) # [0.00027803096387751553, 0.9948403768236574]
97
+ ```
98
+
99
+ #### For LLM-based reranker
100
+
101
+ ```python
102
+ from FlagEmbedding import FlagLLMReranker
103
+ reranker = FlagLLMReranker('BAAI/bge-reranker-v2-gemma', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
104
+ # reranker = FlagLLMReranker('BAAI/bge-reranker-v2-gemma', use_bf16=True) # You can also set use_bf16=True to speed up computation with a slight performance degradation
105
+
106
+ score = reranker.compute_score(['query', 'passage'])
107
+ print(score)
108
+
109
+ scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']])
110
+ print(scores)
111
+ ```
112
+
113
+ #### For LLM-based layerwise reranker
114
+
115
+ ```python
116
+ from FlagEmbedding import LayerWiseFlagLLMReranker
117
+ reranker = LayerWiseFlagLLMReranker('BAAI/bge-reranker-v2-minicpm-layerwise', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
118
+ # reranker = LayerWiseFlagLLMReranker('BAAI/bge-reranker-v2-minicpm-layerwise', use_bf16=True) # You can also set use_bf16=True to speed up computation with a slight performance degradation
119
+
120
+ score = reranker.compute_score(['query', 'passage'], cutoff_layers=[28]) # Adjusting 'cutoff_layers' to pick which layers are used for computing the score.
121
+ print(score)
122
+
123
+ scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']], cutoff_layers=[28])
124
+ print(scores)
125
+ ```
126
+
127
+ ### Using Huggingface transformers
128
+
129
+ #### For normal reranker (bge-reranker-base / bge-reranker-large / bge-reranker-v2-m3 )
130
+
131
+ Get relevance scores (higher scores indicate more relevance):
132
+
133
+ ```python
134
+ import torch
135
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
136
+
137
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-v2-m3')
138
+ model = AutoModelForSequenceClassification.from_pretrained('BAAI/bge-reranker-v2-m3')
139
+ model.eval()
140
+
141
+ pairs = [['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]
142
+ with torch.no_grad():
143
+ inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
144
+ scores = model(**inputs, return_dict=True).logits.view(-1, ).float()
145
+ print(scores)
146
+ ```
147
+
148
+ #### For LLM-based reranker
149
+
150
+ ```python
151
+ import torch
152
+ from transformers import AutoModelForCausalLM, AutoTokenizer
153
+
154
+ def get_inputs(pairs, tokenizer, prompt=None, max_length=1024):
155
+ if prompt is None:
156
+ prompt = "Given a query A and a passage B, determine whether the passage contains an answer to the query by providing a prediction of either 'Yes' or 'No'."
157
+ sep = "\n"
158
+ prompt_inputs = tokenizer(prompt,
159
+ return_tensors=None,
160
+ add_special_tokens=False)['input_ids']
161
+ sep_inputs = tokenizer(sep,
162
+ return_tensors=None,
163
+ add_special_tokens=False)['input_ids']
164
+ inputs = []
165
+ for query, passage in pairs:
166
+ query_inputs = tokenizer(f'A: {query}',
167
+ return_tensors=None,
168
+ add_special_tokens=False,
169
+ max_length=max_length * 3 // 4,
170
+ truncation=True)
171
+ passage_inputs = tokenizer(f'B: {passage}',
172
+ return_tensors=None,
173
+ add_special_tokens=False,
174
+ max_length=max_length,
175
+ truncation=True)
176
+ item = tokenizer.prepare_for_model(
177
+ [tokenizer.bos_token_id] + query_inputs['input_ids'],
178
+ sep_inputs + passage_inputs['input_ids'],
179
+ truncation='only_second',
180
+ max_length=max_length,
181
+ padding=False,
182
+ return_attention_mask=False,
183
+ return_token_type_ids=False,
184
+ add_special_tokens=False
185
+ )
186
+ item['input_ids'] = item['input_ids'] + sep_inputs + prompt_inputs
187
+ item['attention_mask'] = [1] * len(item['input_ids'])
188
+ inputs.append(item)
189
+ return tokenizer.pad(
190
+ inputs,
191
+ padding=True,
192
+ max_length=max_length + len(sep_inputs) + len(prompt_inputs),
193
+ pad_to_multiple_of=8,
194
+ return_tensors='pt',
195
+ )
196
+
197
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-v2-gemma')
198
+ model = AutoModelForCausalLM.from_pretrained('BAAI/bge-reranker-v2-gemma')
199
+ yes_loc = tokenizer('Yes', add_special_tokens=False)['input_ids'][0]
200
+ model.eval()
201
+
202
+ pairs = [['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]
203
+ with torch.no_grad():
204
+ inputs = get_inputs(pairs, tokenizer)
205
+ scores = model(**inputs, return_dict=True).logits[:, -1, yes_loc].view(-1, ).float()
206
+ print(scores)
207
+ ```
208
+
209
+ #### For LLM-based layerwise reranker
210
+
211
+ ```python
212
+ import torch
213
+ from transformers import AutoModelForCausalLM, AutoTokenizer
214
+
215
+ def get_inputs(pairs, tokenizer, prompt=None, max_length=1024):
216
+ if prompt is None:
217
+ prompt = "Given a query A and a passage B, determine whether the passage contains an answer to the query by providing a prediction of either 'Yes' or 'No'."
218
+ sep = "\n"
219
+ prompt_inputs = tokenizer(prompt,
220
+ return_tensors=None,
221
+ add_special_tokens=False)['input_ids']
222
+ sep_inputs = tokenizer(sep,
223
+ return_tensors=None,
224
+ add_special_tokens=False)['input_ids']
225
+ inputs = []
226
+ for query, passage in pairs:
227
+ query_inputs = tokenizer(f'A: {query}',
228
+ return_tensors=None,
229
+ add_special_tokens=False,
230
+ max_length=max_length * 3 // 4,
231
+ truncation=True)
232
+ passage_inputs = tokenizer(f'B: {passage}',
233
+ return_tensors=None,
234
+ add_special_tokens=False,
235
+ max_length=max_length,
236
+ truncation=True)
237
+ item = tokenizer.prepare_for_model(
238
+ [tokenizer.bos_token_id] + query_inputs['input_ids'],
239
+ sep_inputs + passage_inputs['input_ids'],
240
+ truncation='only_second',
241
+ max_length=max_length,
242
+ padding=False,
243
+ return_attention_mask=False,
244
+ return_token_type_ids=False,
245
+ add_special_tokens=False
246
+ )
247
+ item['input_ids'] = item['input_ids'] + sep_inputs + prompt_inputs
248
+ item['attention_mask'] = [1] * len(item['input_ids'])
249
+ inputs.append(item)
250
+ return tokenizer.pad(
251
+ inputs,
252
+ padding=True,
253
+ max_length=max_length + len(sep_inputs) + len(prompt_inputs),
254
+ pad_to_multiple_of=8,
255
+ return_tensors='pt',
256
+ )
257
+
258
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-v2-minicpm-layerwise', trust_remote_code=True)
259
+ model = AutoModelForCausalLM.from_pretrained('BAAI/bge-reranker-v2-minicpm-layerwise', trust_remote_code=True, torch_dtype=torch.bfloat16)
260
+ model = model.to('cuda')
261
+ model.eval()
262
+
263
+ pairs = [['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]
264
+ with torch.no_grad():
265
+ inputs = get_inputs(pairs, tokenizer).to(model.device)
266
+ all_scores = model(**inputs, return_dict=True, cutoff_layers=[28])
267
+ all_scores = [scores[:, -1].view(-1, ).float() for scores in all_scores[0]]
268
+ print(all_scores)
269
+ ```
270
+
271
+ ## Fine-tune
272
+
273
+ ### Data Format
274
+
275
+ Train data should be a json file, where each line is a dict like this:
276
+
277
+ ```
278
+ {"query": str, "pos": List[str], "neg":List[str], "prompt": str}
279
+ ```
280
+
281
+ `query` is the query, and `pos` is a list of positive texts, `neg` is a list of negative texts, `prompt` indicates the relationship between query and texts. If you have no negative texts for a query, you can random sample some from the entire corpus as the negatives.
282
+
283
+ See [toy_finetune_data.jsonl](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/llm_reranker/toy_finetune_data.jsonl) for a toy data file.
284
+
285
+ ### Train
286
+
287
+ You can fine-tune the reranker with the following code:
288
+
289
+ **For llm-based reranker**
290
+
291
+ ```shell
292
+ torchrun --nproc_per_node {number of gpus} \
293
+ -m FlagEmbedding.llm_reranker.finetune_for_instruction.run \
294
+ --output_dir {path to save model} \
295
+ --model_name_or_path google/gemma-2b \
296
+ --train_data ./toy_finetune_data.jsonl \
297
+ --learning_rate 2e-4 \
298
+ --num_train_epochs 1 \
299
+ --per_device_train_batch_size 1 \
300
+ --gradient_accumulation_steps 16 \
301
+ --dataloader_drop_last True \
302
+ --query_max_len 512 \
303
+ --passage_max_len 512 \
304
+ --train_group_size 16 \
305
+ --logging_steps 1 \
306
+ --save_steps 2000 \
307
+ --save_total_limit 50 \
308
+ --ddp_find_unused_parameters False \
309
+ --gradient_checkpointing \
310
+ --deepspeed stage1.json \
311
+ --warmup_ratio 0.1 \
312
+ --bf16 \
313
+ --use_lora True \
314
+ --lora_rank 32 \
315
+ --lora_alpha 64 \
316
+ --use_flash_attn True \
317
+ --target_modules q_proj k_proj v_proj o_proj
318
+ ```
319
+
320
+ **For llm-based layerwise reranker**
321
+
322
+ ```shell
323
+ torchrun --nproc_per_node {number of gpus} \
324
+ -m FlagEmbedding.llm_reranker.finetune_for_layerwise.run \
325
+ --output_dir {path to save model} \
326
+ --model_name_or_path openbmb/MiniCPM-2B-dpo-bf16 \
327
+ --train_data ./toy_finetune_data.jsonl \
328
+ --learning_rate 2e-4 \
329
+ --num_train_epochs 1 \
330
+ --per_device_train_batch_size 1 \
331
+ --gradient_accumulation_steps 16 \
332
+ --dataloader_drop_last True \
333
+ --query_max_len 512 \
334
+ --passage_max_len 512 \
335
+ --train_group_size 16 \
336
+ --logging_steps 1 \
337
+ --save_steps 2000 \
338
+ --save_total_limit 50 \
339
+ --ddp_find_unused_parameters False \
340
+ --gradient_checkpointing \
341
+ --deepspeed stage1.json \
342
+ --warmup_ratio 0.1 \
343
+ --bf16 \
344
+ --use_lora True \
345
+ --lora_rank 32 \
346
+ --lora_alpha 64 \
347
+ --use_flash_attn True \
348
+ --target_modules q_proj k_proj v_proj o_proj \
349
+ --start_layer 8 \
350
+ --head_multi True \
351
+ --head_type simple \
352
+ --lora_extra_parameters linear_head
353
+ ```
354
+
355
+ Our rerankers are initialized from [google/gemma-2b](https://huggingface.co/google/gemma-2b) (for llm-based reranker) and [openbmb/MiniCPM-2B-dpo-bf16](https://huggingface.co/openbmb/MiniCPM-2B-dpo-bf16) (for llm-based layerwise reranker), and we train it on a mixture of multilingual datasets:
356
+
357
+ - [bge-m3-data](https://huggingface.co/datasets/Shitao/bge-m3-data)
358
+ - [quora train data](https://huggingface.co/datasets/quora)
359
+ - [fever train data](https://fever.ai/dataset/fever.html)
360
+
361
+ ## Evaluation
362
+
363
+ - llama-index.
364
+
365
+ ![image-20240317193909373](./assets/llama-index.png)
366
+
367
+
368
+ - BEIR.
369
+
370
+ rereank the top 100 results from bge-en-v1.5 large.
371
+
372
+ ![image-20240317174633333](./assets/BEIR-bge-en-v1.5.png)
373
+
374
+ rereank the top 100 results from e5 mistral 7b instruct.
375
+
376
+ ![image-20240317172949713](./assets/BEIR-e5-mistral.png)
377
+
378
+ - CMTEB-retrieval.
379
+ It rereank the top 100 results from bge-zh-v1.5 large.
380
+
381
+ ![image-20240317173026235](./assets/CMTEB-retrieval-bge-zh-v1.5.png)
382
+
383
+ - miracl (multi-language).
384
+ It rereank the top 100 results from bge-m3.
385
+
386
+ ![image-20240317173117639](./assets/miracl-bge-m3.png)
387
+
388
+
389
+
390
+ ## Citation
391
+
392
+ If you find this repository useful, please consider giving a star and citation
393
+
394
+ ```bibtex
395
+ @misc{li2023making,
396
+ title={Making Large Language Models A Better Foundation For Dense Retrieval},
397
+ author={Chaofan Li and Zheng Liu and Shitao Xiao and Yingxia Shao},
398
+ year={2023},
399
+ eprint={2312.15503},
400
+ archivePrefix={arXiv},
401
+ primaryClass={cs.CL}
402
+ }
403
+ @misc{chen2024bge,
404
+ title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation},
405
+ author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu},
406
+ year={2024},
407
+ eprint={2402.03216},
408
+ archivePrefix={arXiv},
409
+ primaryClass={cs.CL}
410
+ }
411
+ ```
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "XLMRobertaModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 1024,
12
+ "id2label": {
13
+ "0": "LABEL_0"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 4096,
17
+ "label2id": {
18
+ "LABEL_0": 0
19
+ },
20
+ "layer_norm_eps": 1e-05,
21
+ "max_position_embeddings": 8194,
22
+ "model_type": "xlm-roberta",
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
+ "quantization_config": {
29
+ "_load_in_4bit": true,
30
+ "_load_in_8bit": false,
31
+ "bnb_4bit_compute_dtype": "bfloat16",
32
+ "bnb_4bit_quant_storage": "uint8",
33
+ "bnb_4bit_quant_type": "nf4",
34
+ "bnb_4bit_use_double_quant": true,
35
+ "llm_int8_enable_fp32_cpu_offload": false,
36
+ "llm_int8_has_fp16_weight": false,
37
+ "llm_int8_skip_modules": null,
38
+ "llm_int8_threshold": 6.0,
39
+ "load_in_4bit": true,
40
+ "load_in_8bit": false,
41
+ "quant_method": "bitsandbytes"
42
+ },
43
+ "torch_dtype": "float32",
44
+ "transformers_version": "4.53.1",
45
+ "type_vocab_size": 1,
46
+ "use_cache": true,
47
+ "vocab_size": 250002
48
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f98bd4031af52b6b36a882550c5a7e47f486ecc53e5ef76e5028dd4c40e0d57
3
+ size 1219166205
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:8bf8afbfd11306bd872018c53bfdf2e160a56f8edbcf49933324404791c148d3
3
+ size 17082900
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "model_max_length": 8192,
51
+ "pad_token": "<pad>",
52
+ "sep_token": "</s>",
53
+ "sp_model_kwargs": {},
54
+ "tokenizer_class": "XLMRobertaTokenizer",
55
+ "unk_token": "<unk>"
56
+ }