From 47e855d5d8a7a12c7b0b5b49c2bfb7006a712b87 Mon Sep 17 00:00:00 2001 From: Philipp Emanuel Weidmann Date: Sat, 25 Oct 2025 13:12:18 +0530 Subject: [PATCH] Guard against missing model card data --- src/heretic/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/heretic/main.py b/src/heretic/main.py index 0fb5c62..98da8dc 100644 --- a/src/heretic/main.py +++ b/src/heretic/main.py @@ -20,7 +20,7 @@ from accelerate.utils import ( is_sdaa_available, is_xpu_available, ) -from huggingface_hub import ModelCard +from huggingface_hub import ModelCard, ModelCardData from pydantic import ValidationError from rich.traceback import install @@ -343,6 +343,10 @@ def run(): # we can retrieve the model card. if not Path(settings.model).exists(): card = ModelCard.load(settings.model) + if card.data is None: + card.data = ModelCardData() + if card.data.tags is None: + card.data.tags = [] card.data.tags.append("heretic") card.data.tags.append("uncensored") card.data.tags.append("decensored")