Download testbed/embeddings-benchmark__mteb/tests/test_cli.py from hc99/FEA-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/embeddings-benchmark__mteb/tests/test_cli.py
- Command line
-
hf download hf://datasets/hc99/FEA-Bench/testbed/embeddings-benchmark__mteb/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/embeddings-benchmark__mteb/tests/test_cli.py
1.16 kB
| """tests for the MTEB CLI""" | |
| import subprocess | |
| from pathlib import Path | |
| def test_available_tasks(): | |
| command = "mteb --available_tasks" | |
| result = subprocess.run(command, shell=True, capture_output=True, text=True) | |
| assert result.returncode == 0, "Command failed" | |
| assert ( | |
| "Banking77Classification" in result.stdout | |
| ), "Sample task Banking77Classification task not found in available tasks" | |
| def test_run_task( | |
| model_name: str = "average_word_embeddings_komninos", | |
| task_name="BornholmBitextMining", | |
| ): | |
| command = f"mteb -m {model_name} -t {task_name} --verbosity 3 --output_folder tests/results/test_model" | |
| result = subprocess.run(command, shell=True, capture_output=True, text=True) | |
| assert result.returncode == 0, "Command failed" | |
| path = Path("tests/results/test_model") | |
| assert path.exists(), "Output folder not created" | |
| json_files = list(path.glob("*.json")) | |
| assert "model_meta.json" in [ | |
| f.name for f in json_files | |
| ], "model_meta.json not found in output folder" | |
| assert f"{task_name}.json" in [ | |
| f.name for f in json_files | |
| ], f"{task_name} not found in output folder" | |