mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-14 15:27:42 +01:00
fix: check tasks in HubApi.set_repo_visibility (#1570)
* bump version * Feat/update default revision (#1553) * Feat: add set_repo_visibility in hub api (#1564) * add set_repo_visibility * fix cr * fix lint * Add base_model_sub_type for aigc model (#1563) * Feat: add `DEFAULT_MAX_WORKERS` in snapshot_download func (#1566) * fix set_repo_visibility (#1568) Co-authored-by: suluyan <suluyan.sly@aliabab-inc.com> * fix: check tasks * for merge master * fix typo --------- Co-authored-by: suluyan <suluyan.sly@aliabab-inc.com> Co-authored-by: Gongsheng Li <58078985+alcholiclg@users.noreply.github.com> Co-authored-by: Xingjun.Wang <wangxingjun778@163.com> Co-authored-by: 班扬 <xingjun.wxj@alibaba-inc.com>
This commit is contained in:
@@ -2911,6 +2911,12 @@ class HubApi:
|
||||
if repo_type == REPO_TYPE_MODEL:
|
||||
model_info = self.get_model(model_id=repo_id)
|
||||
path = f'{self.endpoint}/api/v1/models/{repo_id}'
|
||||
tasks = model_info.get('Tasks')
|
||||
model_tasks = ''
|
||||
if isinstance(tasks, list) and tasks:
|
||||
first = tasks[0]
|
||||
if isinstance(first, dict) and first:
|
||||
model_tasks = first.get('name')
|
||||
payload = {
|
||||
'ChineseName': model_info.get('ChineseName', ''),
|
||||
'ModelFramework': model_info.get('ModelFramework', 'Pytorch'),
|
||||
@@ -2924,7 +2930,7 @@ class HubApi:
|
||||
'SubScientificField': model_info.get('SubScientificField', None),
|
||||
'ScientificField': model_info.get('NEXA', {}).get('ScientificField', ''),
|
||||
'Source': model_info.get('NEXA', {}).get('Source', ''),
|
||||
'ModelTask': model_info.get('Tasks', [{}])[0].get('name'),
|
||||
'ModelTask': model_tasks,
|
||||
'License': model_info.get('License', ''),
|
||||
}
|
||||
elif repo_type == REPO_TYPE_DATASET:
|
||||
|
||||
Reference in New Issue
Block a user