(
config_path: Path,
compare_to: Optional[Path],
gpu: bool,
optimize: Optimizations,
pretraining: bool,
markdown: bool,
)
| 70 | |
| 71 | |
| 72 | def debug_diff( |
| 73 | config_path: Path, |
| 74 | compare_to: Optional[Path], |
| 75 | gpu: bool, |
| 76 | optimize: Optimizations, |
| 77 | pretraining: bool, |
| 78 | markdown: bool, |
| 79 | ): |
| 80 | msg = Printer() |
| 81 | with show_validation_error(hint_fill=False): |
| 82 | user_config = load_config(config_path) |
| 83 | if compare_to: |
| 84 | other_config = load_config(compare_to) |
| 85 | else: |
| 86 | # Recreate a default config based from user's config |
| 87 | lang = user_config["nlp"]["lang"] |
| 88 | pipeline = list(user_config["nlp"]["pipeline"]) |
| 89 | msg.info(f"Found user-defined language: '{lang}'") |
| 90 | msg.info(f"Found user-defined pipelines: {pipeline}") |
| 91 | other_config = init_config( |
| 92 | lang=lang, |
| 93 | pipeline=pipeline, |
| 94 | optimize=optimize.value, |
| 95 | gpu=gpu, |
| 96 | pretraining=pretraining, |
| 97 | silent=True, |
| 98 | ) |
| 99 | |
| 100 | user = user_config.to_str() |
| 101 | other = other_config.to_str() |
| 102 | |
| 103 | if user == other: |
| 104 | msg.warn("No diff to show: configs are identical") |
| 105 | else: |
| 106 | diff_text = diff_strings(other, user, add_symbols=markdown) |
| 107 | if markdown: |
| 108 | md = MarkdownRenderer() |
| 109 | md.add(md.code_block(diff_text, "diff")) |
| 110 | print(md.text) |
| 111 | else: |
| 112 | print(diff_text) |
no test coverage detected
searching dependent graphs…