MCPcopy
hub / github.com/gpustack/gpustack / generate_markdown

Function generate_markdown

hack/perf/perf_doc_common.py:717–794  ·  view source on GitHub ↗
(
    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,
)

Source from the content-addressed store, hash-verified

715
716
717def 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("")

Callers

nothing calls this directly

Calls 13

render_result_imageFunction · 0.85
render_setup_listFunction · 0.85
render_profile_configFunction · 0.85
render_record_sectionFunction · 0.85
extendMethod · 0.80
appendMethod · 0.80
listFunction · 0.50

Tested by

no test coverage detected