Show a diff of a config file with respect to spaCy's defaults or another config file. If additional settings were used in the creation of the config file, then you must supply these as extra parameters to the command when comparing to the default settings. The generated diff can also be
(
# fmt: off
ctx: typer.Context,
config_path: Path = Arg(
..., help="Path to config file", exists=True, allow_dash=True
),
compare_to: Optional[Path] = Opt(
None,
help="Path to a config file to diff against, or `None` to compare against default settings",
exists=True,
allow_dash=True,
),
optimize: Optimizations = Opt(
Optimizations.efficiency.value,
"--optimize",
"-o",
help="Whether the user config was optimized for efficiency or accuracy. Only relevant when comparing against the default config.",
),
gpu: bool = Opt(
False,
"--gpu",
"-G",
help="Whether the original config can run on a GPU. Only relevant when comparing against the default config.",
),
pretraining: bool = Opt(
False,
"--pretraining",
"--pt",
help="Whether to compare on a config with pretraining involved. Only relevant when comparing against the default config.",
),
markdown: bool = Opt(
False, "--markdown", "-md", help="Generate Markdown for GitHub issues"
),
# fmt: on
)
| 14 | context_settings={"allow_extra_args": True, "ignore_unknown_options": True}, |
| 15 | ) |
| 16 | def debug_diff_cli( |
| 17 | # fmt: off |
| 18 | ctx: typer.Context, |
| 19 | config_path: Path = Arg( |
| 20 | ..., help="Path to config file", exists=True, allow_dash=True |
| 21 | ), |
| 22 | compare_to: Optional[Path] = Opt( |
| 23 | None, |
| 24 | help="Path to a config file to diff against, or `None` to compare against default settings", |
| 25 | exists=True, |
| 26 | allow_dash=True, |
| 27 | ), |
| 28 | optimize: Optimizations = Opt( |
| 29 | Optimizations.efficiency.value, |
| 30 | "--optimize", |
| 31 | "-o", |
| 32 | help="Whether the user config was optimized for efficiency or accuracy. Only relevant when comparing against the default config.", |
| 33 | ), |
| 34 | gpu: bool = Opt( |
| 35 | False, |
| 36 | "--gpu", |
| 37 | "-G", |
| 38 | help="Whether the original config can run on a GPU. Only relevant when comparing against the default config.", |
| 39 | ), |
| 40 | pretraining: bool = Opt( |
| 41 | False, |
| 42 | "--pretraining", |
| 43 | "--pt", |
| 44 | help="Whether to compare on a config with pretraining involved. Only relevant when comparing against the default config.", |
| 45 | ), |
| 46 | markdown: bool = Opt( |
| 47 | False, "--markdown", "-md", help="Generate Markdown for GitHub issues" |
| 48 | ), |
| 49 | # fmt: on |
| 50 | ): |
| 51 | """Show a diff of a config file with respect to spaCy's defaults or another config file. If |
| 52 | additional settings were used in the creation of the config file, then you |
| 53 | must supply these as extra parameters to the command when comparing to the default settings. The generated diff |
| 54 | can also be used when posting to the discussion forum to provide more |
| 55 | information for the maintainers. |
| 56 | |
| 57 | The `optimize`, `gpu`, and `pretraining` options are only relevant when |
| 58 | comparing against the default configuration (or specifically when `compare_to` is None). |
| 59 | |
| 60 | DOCS: https://spacy.io/api/cli#debug-diff |
| 61 | """ |
| 62 | debug_diff( |
| 63 | config_path=config_path, |
| 64 | compare_to=compare_to, |
| 65 | gpu=gpu, |
| 66 | optimize=optimize, |
| 67 | pretraining=pretraining, |
| 68 | markdown=markdown, |
| 69 | ) |
| 70 | |
| 71 | |
| 72 | def debug_diff( |
nothing calls this directly
no test coverage detected
searching dependent graphs…