mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 02:16:32 +03:00
6723d76f24
* Init * Change logger to ConsoleLogger.v2 * adjust naming * More naming adjustments * Fix output_file reference error * ignore type * Add basic test for logger * Hopefully fix mypy issue * mypy ignore line * Update mypy line Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com> * Update test method name Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com> * Change file saving logic * Fix finalize method * increase spacy-legacy version in requirements * Update docs * small adjustments Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
31 lines
600 B
Python
31 lines
600 B
Python
import pytest
|
|
import spacy
|
|
|
|
from spacy.training import loggers
|
|
|
|
|
|
@pytest.fixture()
|
|
def nlp():
|
|
nlp = spacy.blank("en")
|
|
nlp.add_pipe("ner")
|
|
return nlp
|
|
|
|
|
|
@pytest.fixture()
|
|
def info():
|
|
return {
|
|
"losses": {"ner": 100},
|
|
"other_scores": {"ENTS_F": 0.85, "ENTS_P": 0.90, "ENTS_R": 0.80},
|
|
"epoch": 100,
|
|
"step": 125,
|
|
"score": 85,
|
|
}
|
|
|
|
|
|
def test_console_logger(nlp, info):
|
|
console_logger = loggers.console_logger(
|
|
progress_bar=True, console_output=True, output_file=None
|
|
)
|
|
log_step, finalize = console_logger(nlp)
|
|
log_step(info)
|