Skip to content

v0.6.0

Choose a tag to compare

@wangxingjun778 wangxingjun778 released this 29 Oct 15:56
· 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_settings and 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) and set_dataset_category / update_dataset_category (base / science), including version creation, rename-free metadata edits addressed by version name or numeric id, and zone reset to base.
  • 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 (aliases model_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_dataset and the four category setters on LegacyHubApi, with per-call token / endpoint overrides.
  • Atomic deletion at the client layer. api.openapi.delete_{model,dataset}_files exposes the endpoint's single-commit semantics and returns commit_sha, validating the 1–100 distinct-path bound up front.

Enhance

  • Gating stays one boolean switch. gated_mode=True/False works on both create and settings and is not deprecated: True enables application access (server default auto approval), False returns the repository to ordinary private, None leaves the control untouched. Explicit public/internal visibility takes precedence and the switch is warned about and ignored; either boolean with omitted visibility still implies private.
  • update_repo_settings supports models and datasets — display_name, license, visibility, description, task (models only) and gated_mode.
  • Richer RepoInfo — model_category, dataset_category and gated_mode are populated, and a gated repository reads back as Visibility.PRIVATE with gated=True instead of a raw string.
  • Configurable options cache — MODELSCOPE_OPTIONS_CACHE_TTL (default 300, 0 disables).

Refactor

  • create_repo routing is decided before the request and split into explicit steps: a fallback reason (visibility="internal", a license outside the OpenAPI enum, task on 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_mode strings belong to api.openapi payloads, while create_repo / update_repo_settings stay typed around the boolean.
  • delete_repo is no longer described as deprecated for security reasons. It documents the real constraint — the token needs repository deletion permission (10010101003 models, 10020301011 datasets) — and still uses the legacy endpoint, since the contract exposes no repository-deletion route.
  • LegacyHubApi.delete_dataset keeps emitting DeprecationWarning so 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: false for them; gated responses are now mapped to Visibility.PRIVATE + gated=True before the private flag is consulted, so .label, int(), enum comparison and to_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

Full Changelog: v0.5.1...v0.6.0