Repository navigation
v0.6.0
·
2 commits
to release/0.6
since this release
modelscope-hub v0.6.0
Feature
- Model and dataset writes moved to OpenAPI.
create_repo,update_repo_settingsand file deletion now use/openapi/v1; requests the contract cannot express fall back to the legacy endpoint instead of failing. - Zone metadata.
set_model_category/update_model_category(base/aigc/science) andset_dataset_category/update_dataset_category(base/science), including version creation, rename-free metadata edits addressed by version name or numeric id, and zone reset tobase. - Client-side category validation. Weight-file suffixes, required
sample_images, version-name length, version resolution and set-only fields are rejected locally with the same message shape the server returns, so invalid input fails before a request is sent. - Repository detail reads.
get_model/get_dataset(aliasesmodel_info/dataset_info) return the full payload, zone fields included. - Enum option endpoints.
list_aigc_model_options,list_science_model_options,list_science_dataset_options,list_model_options, cached in-process. - New public enums.
RepoVisibility,GatedMode,ModelCategory,DatasetCategory,AigcModelType. - Compat wrappers.
get_model_detail/get_dataset_detail,update_model/update_datasetand the four category setters onLegacyHubApi, with per-calltoken/endpointoverrides. - Atomic deletion at the client layer.
api.openapi.delete_{model,dataset}_filesexposes the endpoint's single-commit semantics and returnscommit_sha, validating the 1–100 distinct-path bound up front.
Enhance
- Gating stays one boolean switch.
gated_mode=True/Falseworks on both create and settings and is not deprecated:Trueenables application access (server defaultautoapproval),Falsereturns the repository to ordinary private,Noneleaves the control untouched. Explicitpublic/internalvisibility takes precedence and the switch is warned about and ignored; either boolean with omitted visibility still implies private. update_repo_settingssupports models and datasets —display_name,license,visibility,description,task(models only) andgated_mode.- Richer
RepoInfo—model_category,dataset_categoryandgated_modeare populated, and a gated repository reads back asVisibility.PRIVATEwithgated=Trueinstead of a raw string. - Configurable options cache —
MODELSCOPE_OPTIONS_CACHE_TTL(default300,0disables).
Refactor
create_reporouting is decided before the request and split into explicit steps: a fallback reason (visibility="internal", a license outside the OpenAPI enum,taskon a dataset, undeclared fields, or the historical boolean), an OpenAPI path, and a legacy path that reproduces the exact previous wire format.- No approval-policy parameter is added to the high-level API: native
gated_modestrings belong toapi.openapipayloads, whilecreate_repo/update_repo_settingsstay typed around the boolean. delete_repois no longer described as deprecated for security reasons. It documents the real constraint — the token needs repository deletion permission (10010101003models,10020301011datasets) — and still uses the legacy endpoint, since the contract exposes no repository-deletion route.LegacyHubApi.delete_datasetkeeps emittingDeprecationWarningso existing warning filters still apply, but the message now states the permission requirement.
Fix
- Gated repositories are no longer reported as public. The server sends
private: falsefor them; gated responses are now mapped toVisibility.PRIVATE+gated=Truebefore the private flag is consulted, so.label,int(), enum comparison andto_dict()all keep working. LegacyHubApi.create_dataset(description=...)now sends the description instead of dropping it silently.- Invalid deletions fail locally — empty or over-100 path payloads raise before a request is made.
Behaviour changes
| Change | Detail |
|---|---|
| Default license | Omitted license lets the Hub apply apache-2.0 instead of the SDK sending Apache-2.0 — OpenAPI route only; forced-legacy calls keep the historical value. |
| Settings capability | update_repo_settings(repo_type="model"/"dataset") succeeds where it used to raise NotSupportedError, so exception-based capability probing changes. login_required and mcp still raise. |
| Deletion warnings | HubApi.delete_repo no longer warns; strict -W error::DeprecationWarning environments that relied on that raise will not see it. |
| Deletion routing | delete_files still commits deletions directly, keeping glob support and no 100-path ceiling; tag revisions may be rejected by repository policy. |
Unchanged on purpose: gated_mode=True/False request format (Visibility + ProtectedMode=1/2), ms-hub create --gated/--no-gated, the compat AIGC creation path, and list_* page-size handling (documented only, not clamped).
Docs
- README: visibility and gated-access semantics for the boolean switch, model/dataset zone walkthroughs, option-endpoint usage and enum-id guidance, a behaviour-change table for the OpenAPI migration, deletion-permission notes, the new environment variable, and a bounded detail-read wait after creating a version.
What's Changed
- Add latest openapi support by @wangxingjun778 in #77
Full Changelog: v0.5.1...v0.6.0