Update README.md
Browse files
README.md
CHANGED
@@ -5,6 +5,82 @@ tags:
|
|
5 |
- transformers
|
6 |
- sentence-transformers
|
7 |
- text-embeddings-inference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
## gte-multilingual-reranker-base
|
@@ -22,6 +98,10 @@ The **gte-multilingual-reranker-base** model is the first reranker model in the
|
|
22 |
|
23 |
|
24 |
### Usage
|
|
|
|
|
|
|
|
|
25 |
|
26 |
Using Huggingface transformers (transformers>=4.36.0)
|
27 |
```
|
@@ -31,7 +111,10 @@ from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
31 |
model_name_or_path = "Alibaba-NLP/gte-multilingual-reranker-base"
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
34 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
|
|
|
|
|
|
35 |
model.eval()
|
36 |
|
37 |
pairs = [["中国的首都在哪儿","北京"], ["what is the capital of China?", "北京"], ["how to implement quick sort in python?","Introduction of quick sort"]]
|
@@ -43,8 +126,6 @@ with torch.no_grad():
|
|
43 |
# tensor([1.2315, 0.5923, 0.3041])
|
44 |
```
|
45 |
|
46 |
-
### How to use it offline
|
47 |
-
Refer to [Disable trust_remote_code](https://huggingface.co/Alibaba-NLP/new-impl/discussions/2#662b08d04d8c3d0a09c88fa3)
|
48 |
|
49 |
## Evaluation
|
50 |
|
|
|
5 |
- transformers
|
6 |
- sentence-transformers
|
7 |
- text-embeddings-inference
|
8 |
+
language:
|
9 |
+
- af
|
10 |
+
- ar
|
11 |
+
- az
|
12 |
+
- be
|
13 |
+
- bg
|
14 |
+
- bn
|
15 |
+
- ca
|
16 |
+
- ceb
|
17 |
+
- cs
|
18 |
+
- cy
|
19 |
+
- da
|
20 |
+
- de
|
21 |
+
- el
|
22 |
+
- en
|
23 |
+
- es
|
24 |
+
- et
|
25 |
+
- eu
|
26 |
+
- fa
|
27 |
+
- fi
|
28 |
+
- fr
|
29 |
+
- gl
|
30 |
+
- gu
|
31 |
+
- he
|
32 |
+
- hi
|
33 |
+
- hr
|
34 |
+
- ht
|
35 |
+
- hu
|
36 |
+
- hy
|
37 |
+
- id
|
38 |
+
- is
|
39 |
+
- it
|
40 |
+
- ja
|
41 |
+
- jv
|
42 |
+
- ka
|
43 |
+
- kk
|
44 |
+
- km
|
45 |
+
- kn
|
46 |
+
- ko
|
47 |
+
- ky
|
48 |
+
- lo
|
49 |
+
- lt
|
50 |
+
- lv
|
51 |
+
- mk
|
52 |
+
- ml
|
53 |
+
- mn
|
54 |
+
- mr
|
55 |
+
- ms
|
56 |
+
- my
|
57 |
+
- ne
|
58 |
+
- nl
|
59 |
+
- 'no'
|
60 |
+
- pa
|
61 |
+
- pl
|
62 |
+
- pt
|
63 |
+
- qu
|
64 |
+
- ro
|
65 |
+
- ru
|
66 |
+
- si
|
67 |
+
- sk
|
68 |
+
- sl
|
69 |
+
- so
|
70 |
+
- sq
|
71 |
+
- sr
|
72 |
+
- sv
|
73 |
+
- sw
|
74 |
+
- ta
|
75 |
+
- te
|
76 |
+
- th
|
77 |
+
- tl
|
78 |
+
- tr
|
79 |
+
- uk
|
80 |
+
- ur
|
81 |
+
- vi
|
82 |
+
- yo
|
83 |
+
- zh
|
84 |
---
|
85 |
|
86 |
## gte-multilingual-reranker-base
|
|
|
98 |
|
99 |
|
100 |
### Usage
|
101 |
+
- **It is recommended to install xformers and enable unpadding for acceleration,
|
102 |
+
refer to [enable-unpadding-and-xformers](https://huggingface.co/Alibaba-NLP/new-impl#recommendation-enable-unpadding-and-acceleration-with-xformers).**
|
103 |
+
- **How to use it offline: [new-impl/discussions/2](https://huggingface.co/Alibaba-NLP/new-impl/discussions/2#662b08d04d8c3d0a09c88fa3)**
|
104 |
+
|
105 |
|
106 |
Using Huggingface transformers (transformers>=4.36.0)
|
107 |
```
|
|
|
111 |
model_name_or_path = "Alibaba-NLP/gte-multilingual-reranker-base"
|
112 |
|
113 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
114 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
115 |
+
model_name_or_path, trust_remote_code=True,
|
116 |
+
torch_dtype=torch.float16
|
117 |
+
)
|
118 |
model.eval()
|
119 |
|
120 |
pairs = [["中国的首都在哪儿","北京"], ["what is the capital of China?", "北京"], ["how to implement quick sort in python?","Introduction of quick sort"]]
|
|
|
126 |
# tensor([1.2315, 0.5923, 0.3041])
|
127 |
```
|
128 |
|
|
|
|
|
129 |
|
130 |
## Evaluation
|
131 |
|