(
title: str,
baseline: BenchmarkRecord,
grouped_records: list[tuple[str, list[BenchmarkRecord]]],
other_grouped_records: list[tuple[str, list[BenchmarkRecord]]],
summary_rows_builder: Callable[[BenchmarkRecord, list[BenchmarkRecord]], list[str]],
image_alt_text: str,
image_name: str = "replace-this-image.png",
declared_models: list[str] | None = None,
)
| 715 | |
| 716 | |
| 717 | def generate_markdown( |
| 718 | title: str, |
| 719 | baseline: BenchmarkRecord, |
| 720 | grouped_records: list[tuple[str, list[BenchmarkRecord]]], |
| 721 | other_grouped_records: list[tuple[str, list[BenchmarkRecord]]], |
| 722 | summary_rows_builder: Callable[[BenchmarkRecord, list[BenchmarkRecord]], list[str]], |
| 723 | image_alt_text: str, |
| 724 | image_name: str = "replace-this-image.png", |
| 725 | declared_models: list[str] | None = None, |
| 726 | ) -> str: |
| 727 | summary_records = [record for _, records in grouped_records for record in records] |
| 728 | all_records = summary_records + [ |
| 729 | record for _, records in other_grouped_records for record in records |
| 730 | ] |
| 731 | summary_rows = summary_rows_builder(baseline, summary_records) |
| 732 | models, hardware, engine_versions = collect_experimental_setup( |
| 733 | all_records, declared_models=declared_models |
| 734 | ) |
| 735 | profile_configs = collect_profiles_from_results(all_records) |
| 736 | used_profiles = list(profile_configs.keys()) |
| 737 | |
| 738 | sections = [ |
| 739 | f"# {title}", |
| 740 | "", |
| 741 | "## Conclusion", |
| 742 | "", |
| 743 | render_result_image(image_alt_text, image_name), |
| 744 | "", |
| 745 | "Comparison of benchmark results before and after optimization:", |
| 746 | "", |
| 747 | *summary_rows, |
| 748 | "", |
| 749 | *render_standard_note_block(), |
| 750 | "## Experimental Setup", |
| 751 | "", |
| 752 | *render_setup_list("Model", models), |
| 753 | *render_setup_list("Hardware", hardware), |
| 754 | *render_setup_list("Engine Version", engine_versions), |
| 755 | *render_benchmark_method_intro(), |
| 756 | ] |
| 757 | |
| 758 | for profile_name in used_profiles: |
| 759 | sections.extend( |
| 760 | render_profile_config(profile_name, profile_configs.get(profile_name)) |
| 761 | ) |
| 762 | |
| 763 | sections.extend(render_open_source_replacement(profile_configs)) |
| 764 | |
| 765 | sections.extend( |
| 766 | [ |
| 767 | "## Experiment Results", |
| 768 | "", |
| 769 | ] |
| 770 | ) |
| 771 | |
| 772 | for group_name, records in grouped_records: |
| 773 | sections.append(f"### {group_name}") |
| 774 | sections.append("") |
nothing calls this directly
no test coverage detected