mirror of https://github.com/explosion/spaCy.git
Call rmtree and copytree with strings (closes #3713)
This commit is contained in:
parent
21af12eb53
commit
6b3a79ac96
|
@ -16,6 +16,7 @@ import random
|
||||||
from .._ml import create_default_optimizer
|
from .._ml import create_default_optimizer
|
||||||
from ..attrs import PROB, IS_OOV, CLUSTER, LANG
|
from ..attrs import PROB, IS_OOV, CLUSTER, LANG
|
||||||
from ..gold import GoldCorpus
|
from ..gold import GoldCorpus
|
||||||
|
from ..compat import path2str
|
||||||
from .. import util
|
from .. import util
|
||||||
from .. import about
|
from .. import about
|
||||||
|
|
||||||
|
@ -423,10 +424,12 @@ def _collate_best_model(meta, output_path, components):
|
||||||
for component in components:
|
for component in components:
|
||||||
bests[component] = _find_best(output_path, component)
|
bests[component] = _find_best(output_path, component)
|
||||||
best_dest = output_path / "model-best"
|
best_dest = output_path / "model-best"
|
||||||
shutil.copytree(output_path / "model-final", best_dest)
|
shutil.copytree(path2str(output_path / "model-final"), path2str(best_dest))
|
||||||
for component, best_component_src in bests.items():
|
for component, best_component_src in bests.items():
|
||||||
shutil.rmtree(best_dest / component)
|
shutil.rmtree(path2str(best_dest / component))
|
||||||
shutil.copytree(best_component_src / component, best_dest / component)
|
shutil.copytree(
|
||||||
|
path2str(best_component_src / component), path2str(best_dest / component)
|
||||||
|
)
|
||||||
accs = srsly.read_json(best_component_src / "accuracy.json")
|
accs = srsly.read_json(best_component_src / "accuracy.json")
|
||||||
for metric in _get_metrics(component):
|
for metric in _get_metrics(component):
|
||||||
meta["accuracy"][metric] = accs[metric]
|
meta["accuracy"][metric] = accs[metric]
|
||||||
|
|
Loading…
Reference in New Issue