thenlper alvarobartt HF Staff commited on
Commit
f7481e6
·
verified ·
1 Parent(s): 5e9cbf6

Add Text Embeddings Inference (TEI) tag & snippet (#15)

Browse files

- Add Text Embeddings Inference (TEI) tag & snippet (c2c3466f6bb32f168f3df9d76b2aa27023de1336)
- Remove not-required `--platform` in `docker run` for GPU (204bdd4d405882a9e8ca9452c223fc49f02e8451)


Co-authored-by: Alvaro Bartolome <[email protected]>

Files changed (1) hide show
  1. README.md +40 -0
README.md CHANGED
@@ -10,6 +10,7 @@ library_name: transformers
10
  tags:
11
  - sentence-transformers
12
  - transformers.js
 
13
  ---
14
 
15
  # gte-reranker-modernbert-base
@@ -129,6 +130,45 @@ const { logits } = await model(inputs);
129
  console.log(logits.tolist()); // [[2.138258218765259], [2.4609625339508057], [-1.6775450706481934]]
130
  ```
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  ## Training Details
133
 
134
  The `gte-modernbert` series of models follows the training scheme of the previous [GTE models](https://huggingface.co/collections/Alibaba-NLP/gte-models-6680f0b13f885cb431e6d469), with the only difference being that the pre-training language model base has been replaced from [GTE-MLM](https://huggingface.co/Alibaba-NLP/gte-en-mlm-base) to [ModernBert](https://huggingface.co/answerdotai/ModernBERT-base). For more training details, please refer to our paper: [mGTE: Generalized Long-Context Text Representation and Reranking Models for Multilingual Text Retrieval](https://aclanthology.org/2024.emnlp-industry.103/)
 
10
  tags:
11
  - sentence-transformers
12
  - transformers.js
13
+ - text-embeddings-inference
14
  ---
15
 
16
  # gte-reranker-modernbert-base
 
130
  console.log(logits.tolist()); // [[2.138258218765259], [2.4609625339508057], [-1.6775450706481934]]
131
  ```
132
 
133
+ Additionally, you can also deploy `Alibaba-NLP/gte-reranker-modernbert-base` with [Text Embeddings Inference (TEI)](https://github.com/huggingface/text-embeddings-inference) as follows:
134
+
135
+ - CPU
136
+
137
+ ```bash
138
+ docker run --platform linux/amd64 \
139
+ -p 8080:80 \
140
+ -v $PWD/data:/data \
141
+ --pull always \
142
+ ghcr.io/huggingface/text-embeddings-inference:cpu-1.7 \
143
+ --model-id Alibaba-NLP/gte-reranker-modernbert-base
144
+ ```
145
+
146
+ - GPU
147
+
148
+ ```bash
149
+ docker run --gpus all \
150
+ -p 8080:80 \
151
+ -v $PWD/data:/data \
152
+ --pull always \
153
+ ghcr.io/huggingface/text-embeddings-inference:1.7 \
154
+ --model-id Alibaba-NLP/gte-reranker-modernbert-base
155
+ ```
156
+
157
+ Then you can send requests to the deployed API via the `/rerank` route (see the [Text Embeddings Inference OpenAPI Specification](https://huggingface.github.io/text-embeddings-inference/) for more details):
158
+
159
+ ```bash
160
+ curl https://0.0.0.0:8080/rerank \
161
+ -H "Content-Type: application/json" \
162
+ -d '{
163
+ "query": "What is the capital of China?",
164
+ "raw_scores": false,
165
+ "return_text": false,
166
+ "texts": [ "Beijing" ],
167
+ "truncate": true,
168
+ "truncation_direction": "right"
169
+ }'
170
+ ```
171
+
172
  ## Training Details
173
 
174
  The `gte-modernbert` series of models follows the training scheme of the previous [GTE models](https://huggingface.co/collections/Alibaba-NLP/gte-models-6680f0b13f885cb431e6d469), with the only difference being that the pre-training language model base has been replaced from [GTE-MLM](https://huggingface.co/Alibaba-NLP/gte-en-mlm-base) to [ModernBert](https://huggingface.co/answerdotai/ModernBERT-base). For more training details, please refer to our paper: [mGTE: Generalized Long-Context Text Representation and Reranking Models for Multilingual Text Retrieval](https://aclanthology.org/2024.emnlp-industry.103/)