-
-
Notifications
You must be signed in to change notification settings - Fork 473
Expand file tree
/
Copy pathtest_nel_benchmark.py
More file actions
32 lines (28 loc) · 1.36 KB
/
test_nel_benchmark.py
File metadata and controls
32 lines (28 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
""" Testing all project steps. """
import os
import pytest
from pathlib import Path
import sys
from spacy.cli.project.run import project_run
@pytest.mark.skipif(sys.platform == "win32", reason="Skipping on Windows (for now) due to platform-specific scripts.")
def test_nel_benchmark():
overrides_key = "SPACY_CONFIG_OVERRIDES"
root = Path(__file__).parent
project_run(root, "download_mewsli9", capture=True)
project_run(root, "download_model", capture=True)
project_run(root, "wikid_clone", capture=True)
project_run(root, "preprocess", capture=True)
# Temporarily disable override env variables, since these may result in config validation errors in this
# project-in-project situation.
overrides = os.environ.pop(overrides_key, None)
project_run(root, "wikid_download_assets", capture=True)
project_run(root, "wikid_parse", capture=True)
project_run(root, "wikid_create_kb", capture=True)
# Re-enable config overrides, if set before.
if overrides:
os.environ[overrides_key] = overrides
project_run(root, "parse_corpus", capture=True)
project_run(root, "compile_corpora", capture=True)
project_run(root, "train", capture=True, overrides={"vars.training_max_steps": 1, "vars.training_max_epochs": 1})
project_run(root, "evaluate", capture=True)
project_run(root, "compare_evaluations", capture=True)