UlanYisaev
commited on
Commit
•
a7783ad
1
Parent(s):
a925adb
Update README.md
Browse files
README.md
CHANGED
@@ -33,3 +33,58 @@ After comprehensive testing against various models such as corrius/cross-encoder
|
|
33 |
#### Advantages
|
34 |
- **Improved Accuracy**: Leads to more precise responses from the chatbot, significantly enhancing user experience.
|
35 |
- **Market Relevance**: Offers a competitive edge in German-speaking markets by effectively managing complex queries.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
#### Advantages
|
34 |
- **Improved Accuracy**: Leads to more precise responses from the chatbot, significantly enhancing user experience.
|
35 |
- **Market Relevance**: Offers a competitive edge in German-speaking markets by effectively managing complex queries.
|
36 |
+
|
37 |
+
# Integrating an ONNX Model with Metarank for German Text Re-ranking
|
38 |
+
|
39 |
+
## Setup Local Metarank Instance
|
40 |
+
|
41 |
+
To run Metarank locally, you need to create a `config.yml` file and set up a Docker container. Below are the detailed steps:
|
42 |
+
|
43 |
+
### Step 1: Create Configuration File
|
44 |
+
|
45 |
+
Create a `config.yml` file in the root of your Metarank project:
|
46 |
+
|
47 |
+
```yaml
|
48 |
+
inference:
|
49 |
+
msmarco:
|
50 |
+
type: cross-encoder
|
51 |
+
model: UlanYisaev/msmarco-MiniLM-L12-en-de-v1
|
52 |
+
```
|
53 |
+
|
54 |
+
### Step 2: Run Metarank using Docker
|
55 |
+
```bash
|
56 |
+
cd metarank
|
57 |
+
docker run --name metarank -p 8080:8080 -v $(pwd):/opt/metarank metarank/metarank:latest serve --config /opt/metarank/config.yml
|
58 |
+
```
|
59 |
+
|
60 |
+
### Step 3: Configure Metarank Docker Image to Include config.yml
|
61 |
+
Adjust the Docker configuration to include the config.yml in the build:
|
62 |
+
```bash
|
63 |
+
# Modify build.sbt in Metarank to include the custom script and config
|
64 |
+
new Dockerfile {
|
65 |
+
add(new File("deploy/metarank_custom.sh"), "/metarank.sh")
|
66 |
+
add(new File("config.yml"), "/opt/metarank/config.yml")
|
67 |
+
entryPoint("/metarank.sh")
|
68 |
+
cmd("--help")
|
69 |
+
}
|
70 |
+
|
71 |
+
# Build the Docker image
|
72 |
+
sbt docker
|
73 |
+
```
|
74 |
+
|
75 |
+
deploy/metarank_custom.sh:
|
76 |
+
```bash
|
77 |
+
#!/bin/bash
|
78 |
+
|
79 |
+
set -euxo pipefail
|
80 |
+
OPTS=${JAVA_OPTS:-"-Xmx1700m -verbose:gc"}
|
81 |
+
|
82 |
+
exec /usr/bin/java $OPTS -cp "/app/*" ai.metarank.main.Main serve --config /opt/metarank/config.yml
|
83 |
+
```
|
84 |
+
|
85 |
+
### Step 4: Run and Manage the Docker Container
|
86 |
+
```bash
|
87 |
+
docker run --name metarank -p 8080:8080 metarank/metarank:0.7.8-amd64
|
88 |
+
docker stop metarank
|
89 |
+
docker start metarank
|
90 |
+
```
|