mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-28 21:03:41 +03:00
Auto-format
This commit is contained in:
parent
daa8c3787a
commit
7a354761c7
|
@ -261,7 +261,9 @@ def train(
|
||||||
for name, component in nlp_loaded.pipeline:
|
for name, component in nlp_loaded.pipeline:
|
||||||
if hasattr(component, "cfg"):
|
if hasattr(component, "cfg"):
|
||||||
component.cfg["beam_width"] = beam_width
|
component.cfg["beam_width"] = beam_width
|
||||||
dev_docs = list(corpus.dev_docs(nlp_loaded, gold_preproc=gold_preproc))
|
dev_docs = list(
|
||||||
|
corpus.dev_docs(nlp_loaded, gold_preproc=gold_preproc)
|
||||||
|
)
|
||||||
nwords = sum(len(doc_gold[0]) for doc_gold in dev_docs)
|
nwords = sum(len(doc_gold[0]) for doc_gold in dev_docs)
|
||||||
start_time = timer()
|
start_time = timer()
|
||||||
scorer = nlp_loaded.evaluate(dev_docs, debug)
|
scorer = nlp_loaded.evaluate(dev_docs, debug)
|
||||||
|
@ -289,18 +291,26 @@ def train(
|
||||||
meta["pipeline"] = nlp.pipe_names
|
meta["pipeline"] = nlp.pipe_names
|
||||||
meta["spacy_version"] = ">=%s" % about.__version__
|
meta["spacy_version"] = ">=%s" % about.__version__
|
||||||
if beam_width == 1:
|
if beam_width == 1:
|
||||||
meta["speed"] = {"nwords": nwords, "cpu": cpu_wps, "gpu": gpu_wps}
|
meta["speed"] = {
|
||||||
|
"nwords": nwords,
|
||||||
|
"cpu": cpu_wps,
|
||||||
|
"gpu": gpu_wps,
|
||||||
|
}
|
||||||
meta["accuracy"] = scorer.scores
|
meta["accuracy"] = scorer.scores
|
||||||
else:
|
else:
|
||||||
meta.setdefault("beam_accuracy", {})
|
meta.setdefault("beam_accuracy", {})
|
||||||
meta.setdefault("beam_speed", {})
|
meta.setdefault("beam_speed", {})
|
||||||
meta["beam_accuracy"][beam_width] = scorer.scores
|
meta["beam_accuracy"][beam_width] = scorer.scores
|
||||||
meta["beam_speed"][beam_width] = {"nwords": nwords, "cpu": cpu_wps, "gpu": gpu_wps}
|
meta["beam_speed"][beam_width] = {
|
||||||
|
"nwords": nwords,
|
||||||
|
"cpu": cpu_wps,
|
||||||
|
"gpu": gpu_wps,
|
||||||
|
}
|
||||||
meta["vectors"] = {
|
meta["vectors"] = {
|
||||||
"width": nlp.vocab.vectors_length,
|
"width": nlp.vocab.vectors_length,
|
||||||
"vectors": len(nlp.vocab.vectors),
|
"vectors": len(nlp.vocab.vectors),
|
||||||
"keys": nlp.vocab.vectors.n_keys,
|
"keys": nlp.vocab.vectors.n_keys,
|
||||||
"name": nlp.vocab.vectors.name
|
"name": nlp.vocab.vectors.name,
|
||||||
}
|
}
|
||||||
meta.setdefault("name", "model%d" % i)
|
meta.setdefault("name", "model%d" % i)
|
||||||
meta.setdefault("version", version)
|
meta.setdefault("version", version)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user