Remove output_file from init_config helper

This commit is contained in:
Ines Montani 2020-12-09 10:57:55 +11:00
parent 8f8a7f1733
commit 5d605d539d
1 changed files with 4 additions and 5 deletions

View File

@ -45,15 +45,15 @@ def init_config_cli(
if isinstance(optimize, Optimizations): # instance of enum from the CLI if isinstance(optimize, Optimizations): # instance of enum from the CLI
optimize = optimize.value optimize = optimize.value
pipeline = string_to_list(pipeline) pipeline = string_to_list(pipeline)
is_stdout = str(output_file) == "-"
config = init_config( config = init_config(
output_file,
lang=lang, lang=lang,
pipeline=pipeline, pipeline=pipeline,
optimize=optimize, optimize=optimize,
cpu=cpu, cpu=cpu,
pretraining=pretraining, pretraining=pretraining,
silent=is_stdout,
) )
is_stdout = str(output_file) == "-"
save_config(config, output_file, is_stdout=is_stdout) save_config(config, output_file, is_stdout=is_stdout)
@ -120,16 +120,15 @@ def fill_config(
def init_config( def init_config(
output_file: Path,
*, *,
lang: str, lang: str,
pipeline: List[str], pipeline: List[str],
optimize: str, optimize: str,
cpu: bool, cpu: bool,
pretraining: bool = False, pretraining: bool = False,
silent: bool = True,
) -> Config: ) -> Config:
is_stdout = str(output_file) == "-" msg = Printer(no_print=silent)
msg = Printer(no_print=is_stdout)
with TEMPLATE_PATH.open("r") as f: with TEMPLATE_PATH.open("r") as f:
template = Template(f.read()) template = Template(f.read())
# Filter out duplicates since tok2vec and transformer are added by template # Filter out duplicates since tok2vec and transformer are added by template