mirror of
https://github.com/p-e-w/heretic.git
synced 2026-07-09 17:28:29 +00:00
Guard against missing model card data
This commit is contained in:
parent
e2419de016
commit
47e855d5d8
1 changed files with 5 additions and 1 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue