Fill partial config file with default values. Will add all missing settings from the default config and will create all objects, check the registered functions for their default values and update the base config. This command can be used with a config generated via the training quic
(
# fmt: off
base_path: Path = Arg(
..., help="Path to base config to fill", exists=True, dir_okay=False
),
output_file: Path = Arg(
"-", help="Path to output .cfg file (or - for stdout)", allow_dash=True
),
pretraining: bool = Opt(
False,
"--pretraining",
"-pt",
help="Include config for pretraining (with 'spacy pretrain')",
),
diff: bool = Opt(
False, "--diff", "-D", help="Print a visual diff highlighting the changes"
),
code_path: Optional[Path] = Opt(
None,
"--code-path",
"--code",
"-c",
help="Path to Python file with additional code (registered functions) to be imported",
),
# fmt: on
)
| 118 | |
| 119 | @init_cli.command("fill-config") |
| 120 | def init_fill_config_cli( |
| 121 | # fmt: off |
| 122 | base_path: Path = Arg( |
| 123 | ..., help="Path to base config to fill", exists=True, dir_okay=False |
| 124 | ), |
| 125 | output_file: Path = Arg( |
| 126 | "-", help="Path to output .cfg file (or - for stdout)", allow_dash=True |
| 127 | ), |
| 128 | pretraining: bool = Opt( |
| 129 | False, |
| 130 | "--pretraining", |
| 131 | "-pt", |
| 132 | help="Include config for pretraining (with 'spacy pretrain')", |
| 133 | ), |
| 134 | diff: bool = Opt( |
| 135 | False, "--diff", "-D", help="Print a visual diff highlighting the changes" |
| 136 | ), |
| 137 | code_path: Optional[Path] = Opt( |
| 138 | None, |
| 139 | "--code-path", |
| 140 | "--code", |
| 141 | "-c", |
| 142 | help="Path to Python file with additional code (registered functions) to be imported", |
| 143 | ), |
| 144 | # fmt: on |
| 145 | ): |
| 146 | """ |
| 147 | Fill partial config file with default values. Will add all missing settings |
| 148 | from the default config and will create all objects, check the registered |
| 149 | functions for their default values and update the base config. This command |
| 150 | can be used with a config generated via the training quickstart widget: |
| 151 | https://spacy.io/usage/training#quickstart |
| 152 | |
| 153 | DOCS: https://spacy.io/api/cli#init-fill-config |
| 154 | """ |
| 155 | import_code(code_path) |
| 156 | fill_config(output_file, base_path, pretraining=pretraining, diff=diff) |
| 157 | |
| 158 | |
| 159 | def fill_config( |
nothing calls this directly
no test coverage detected
searching dependent graphs…