KennethEnevoldsen commited on
Commit
bd2df88
1 Parent(s): 0da1545

Added integration tests for MTEB

Browse files
.github/workflows/test.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This workflow will:
2
+ # 1) install Python dependencies
3
+ # 2) run make test
4
+
5
+
6
+ name: Test
7
+ on:
8
+ push:
9
+ branches: [main]
10
+ pull_request:
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: [ubuntu-latest] #, macos-latest, windows-latest]
19
+ python-version: ["3.8"] # , "3.9", "3.10"]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+
24
+ - name: Setup Python ${{ matrix.python-version }}
25
+ uses: actions/setup-python@v4
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+ cache: "pip"
29
+
30
+ - name: Install dependencies
31
+ shell: bash
32
+ run: |
33
+ make install-for-tests
34
+
35
+ - name: Run tests
36
+ shell: bash
37
+ run: |
38
+ make test
.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # python
2
+ __pycache__
3
+
4
+ # vscode
5
+ .vscode/
6
+
7
+ # tmp files
8
+ tmp.py
makefile ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ install-for-tests:
2
+ @echo "--- Installing dependencies for tests ---"
3
+ # just use the dev dependencies from mteb to keep everything compatible
4
+ pip install mteb[dev]
5
+
6
+ test:
7
+ @echo "--- Running tests ---"
8
+ pytest
tests/results/results ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 0da15454bdfbf1e9069adcb9f5a5f29c4d05223a
tests/test_load_results.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from pathlib import Path
3
+
4
+ import mteb
5
+
6
+
7
+ def test_load_results():
8
+ """Ensures that files can be loaded using MTEB"""
9
+ tests_path = Path(__file__).parent / "results"
10
+
11
+ os.environ["MTEB_CACHE"] = str(tests_path)
12
+
13
+ results = mteb.load_results(download_latest=False)
14
+
15
+ assert isinstance(results, dict)
16
+ for model in results:
17
+ assert isinstance(results[model], dict)
18
+ for revision in results[model]:
19
+ assert isinstance(results[model][revision], list)
20
+ for result in results[model][revision]:
21
+ assert isinstance(result, mteb.MTEBResults)
22
+
23
+ known_model = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
24
+ known_revision = "bf3bf13ab40c3157080a7ab344c831b9ad18b5eb"
25
+ assert known_model in results
26
+ assert known_revision in results[known_model]