add ADDITIONAL_README.md
Browse files- ADDITIONAL_README.md +43 -0
ADDITIONAL_README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Multilingual Colbert embeddings as a service
|
| 2 |
+
|
| 3 |
+
## Goal
|
| 4 |
+
|
| 5 |
+
- Deploy [Antoine Louis](https://huggingface.co/antoinelouis)' [colbert-xm](https://huggingface.co/antoinelouis/colbert-xm) as an inference service: text(s) in, vector(s) out
|
| 6 |
+
|
| 7 |
+
## Motivation
|
| 8 |
+
|
| 9 |
+
- use the service in a broader RAG solution
|
| 10 |
+
|
| 11 |
+
## Steps followed
|
| 12 |
+
|
| 13 |
+
- Clone the original repo following [this procedure](https://huggingface.co/docs/hub/repositories-next-steps#how-to-duplicate-or-fork-a-repo-including-lfs-pointers)
|
| 14 |
+
- Add a custom handler script as described [here](https://huggingface.co/docs/inference-endpoints/guides/custom_handler)
|
| 15 |
+
|
| 16 |
+
## Local development and testing
|
| 17 |
+
|
| 18 |
+
### Build and start docker container hf_endpoints_emulator
|
| 19 |
+
|
| 20 |
+
See [hf_endpoints_emulator](https://pypi.org/project/hf-endpoints-emulator/)
|
| 21 |
+
|
| 22 |
+
````bash
|
| 23 |
+
docker-compose up -d --build
|
| 24 |
+
````
|
| 25 |
+
|
| 26 |
+
This can take a few moments to load, given the size of the model (> 3 GB)!
|
| 27 |
+
|
| 28 |
+
## How to test locally
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
./embed_single_query.sh
|
| 32 |
+
./embed_two_chunks.sh
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
docker-compose exec hf_endpoints_emulator pytest
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Check output
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
docker-compose logs --follow hf_endpoints_emulator
|
| 43 |
+
```
|