阿里 ModelScope 发布 v1.40.3:修复离线下载与缓存清理
原标题:v1.40.3
AI 摘要
阿里 ModelScope 发布 v1.40.3 版本,要求依赖 modelscope-hub>=0.7.0,新增 get_hub_cache_root() 等缓存路径工具并统一缓存根目录配置。该版本修复了离线下载问题:local_files_only=True 时不再调用 API 解析默认版本,无网络或凭证也能从缓存下载;同时强化 ms clear-cache 的删除校验,拒绝空标识、路径穿越、越界路径和符号链接。此外还修正了 Hugging Face 异常类型映射与 snapshot_download 的异常导出,保持兼容性。
正文节选
**Enhance** - Requires `modelscope-hub>=0.7.0`. - New `modelscope.utils.file_utils.get_hub_cache_root()`; `modelscope.hub.cache_manager` re-exports `get_cache_root` and `resolve_cached_snapshot`. `MS_CACHE_HOME` is normalised to an absolute path when bridged into the hub config. **Fix** - `model_file_download(..., local_files_only=True)` no longer calls the API to resolve the default revision, so offline downloads from cache work without network access or credentials. - `ms clear-cache`