Add base_model_sub_type for aigc model (#1563)

This commit is contained in:
Xingjun.Wang
2025-12-05 15:41:22 +08:00
committed by GitHub
parent be6874ea8e
commit 7543a9c7d2
3 changed files with 11 additions and 0 deletions

View File

@@ -129,6 +129,11 @@ class CreateCMD(CLICommand):
help=
'Source of the AIGC model. `USER_UPLOAD`, `TRAINED_FROM_MODELSCOPE` or `TRAINED_FROM_ALIYUN_FC`.'
)
aigc_group.add_argument(
'--base_model_sub_type',
type=str,
default='',
help='Base model sub type, e.g., Qwen_Edit_2509')
parser.set_defaults(func=subparser_func)
@@ -191,6 +196,7 @@ class CreateCMD(CLICommand):
base_model_id=self.args.base_model_id,
path_in_repo=self.args.path_in_repo,
model_source=self.args.model_source,
base_model_sub_type=self.args.base_model_sub_type,
)
# Convert visibility string to int for the API call

View File

@@ -305,6 +305,7 @@ class HubApi:
'ModelPath': aigc_model.model_path,
'TriggerWords': aigc_model.trigger_words,
'ModelSource': aigc_model.model_source,
'SubVisionFoundation': aigc_model.base_model_sub_type,
})
if aigc_model.official_tags:

View File

@@ -82,6 +82,7 @@ class AigcModel:
trigger_words: Optional[List[str]] = None,
official_tags: Optional[List[str]] = None,
model_source: Optional[str] = 'USER_UPLOAD',
base_model_sub_type: Optional[str] = '',
):
"""
Initializes the AigcModel helper.
@@ -99,6 +100,7 @@ class AigcModel:
official_tags (List[str], optional): Official tags for the AIGC model. Defaults to None.
model_source (str, optional): Source of the model.
`USER_UPLOAD`, `TRAINED_FROM_MODELSCOPE` or `TRAINED_FROM_ALIYUN_FC`. Defaults to 'USER_UPLOAD'.
base_model_sub_type (str, Optional): Sub vision foundation model type. Defaults to ''. e.g. `SD_1_5`
"""
self.model_path = model_path
self.aigc_type = aigc_type
@@ -106,6 +108,7 @@ class AigcModel:
self.tag = tag
self.description = description
self.model_source = model_source
self.base_model_sub_type = base_model_sub_type
# Process cover images - convert local paths to base64 data URLs
if cover_images is not None:
processed_cover_images = []
@@ -391,6 +394,7 @@ class AigcModel:
'trigger_words': self.trigger_words,
'official_tags': self.official_tags,
'model_source': self.model_source,
'base_model_sub_type': self.base_model_sub_type,
}
@classmethod