From 2ab2c628b4cc633db9a9f07e6f3bf79552285020 Mon Sep 17 00:00:00 2001 From: Vinay Umrethe <175500353+Vinay-Umrethe@users.noreply.github.com> Date: Sun, 15 Nov 2026 03:10:36 +0000 Subject: [PATCH] feat: Add datasets information in the model card --- src/heretic/main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/heretic/main.py b/src/heretic/main.py index b731ab5..7b74fec 100644 --- a/src/heretic/main.py +++ b/src/heretic/main.py @@ -86,6 +86,7 @@ from .config import ( DatasetSpecification, ExportStrategy, QuantizationMethod, + SingleDatasetSpecification, ) from .evaluator import Evaluator from .model import Model, get_model_class @@ -1301,6 +1302,29 @@ def run(): if is_hf_path(settings.model): card.data.base_model = settings.model + # Add the datasets that were used, in the + # `datasets` field of the model card. + flat_specifications: list[ + SingleDatasetSpecification + ] = [] + for specification in dataset_specifications: + if isinstance( + specification, SingleDatasetSpecification + ): + flat_specifications.append(specification) + else: + flat_specifications.extend(specification) + + datasets: list[str] = list( + dict.fromkeys( + specification.dataset + for specification in flat_specifications + if is_hf_path(specification.dataset) + ) + ) + if datasets: + card.data.datasets = datasets + card.text = ( get_readme_intro( settings,