{"id":38171827,"url":"https://github.com/liuyanyi/ms_ipv6","last_synced_at":"2026-01-16T23:27:54.122Z","repository":{"id":328296063,"uuid":"1035426614","full_name":"liuyanyi/ms_ipv6","owner":"liuyanyi","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-12T07:02:38.000Z","size":143,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-13T16:13:14.402Z","etag":null,"topics":["modelscope"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liuyanyi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-10T11:27:33.000Z","updated_at":"2025-12-12T06:40:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/liuyanyi/ms_ipv6","commit_stats":null,"previous_names":["liuyanyi/ms_ipv6"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/liuyanyi/ms_ipv6","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyanyi%2Fms_ipv6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyanyi%2Fms_ipv6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyanyi%2Fms_ipv6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyanyi%2Fms_ipv6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liuyanyi","download_url":"https://codeload.github.com/liuyanyi/ms_ipv6/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyanyi%2Fms_ipv6/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28487586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["modelscope"],"created_at":"2026-01-16T23:27:53.470Z","updated_at":"2026-01-16T23:27:54.111Z","avatar_url":"https://github.com/liuyanyi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModelScope IPv6 Download Assistant\n\n简洁、稳定的 ModelScope 下载助手，专为 IPv6 网络环境优化，采用“两阶段”下载流程，支持并发与续传。\n\n## 亮点特性\n\n- 两阶段下载：先生成“计划”，再按计划高效下载\n- IPv6 优化：可在下载阶段强制仅走 IPv6\n- 并发与续传：多线程下载、跳过已存在或强制覆盖\n- 灵活过滤：按通配符仅下载需要的文件\n- 统一日志：进度条与彩色日志和谐共存\n\n## 安装\n\n```bash\n# 生产环境（不包含 plan 依赖）\npip install .\n\n# 开发环境（不包含 plan 依赖）\npip install -e \".[dev]\"\n\n# 如需使用 plan 子命令，请额外安装可选的 plan 依赖：\npip install -e \".[plan]\"          # 仅 plan 依赖\npip install -e \".[dev,plan]\"      # 开发依赖 + plan 依赖\n```\n\n## 快速开始\n\n1) 生成下载计划（plan）\n\n```bash\n# 模型\nms-ipv6 plan model Qwen/Qwen2-7B-Instruct\n\n# 数据集\nms-ipv6 plan dataset AI-MO/NuminaMath-1.5\n\n# 可选：指定输出 / 过滤 / token\nms-ipv6 plan model user/model \\\n  --output my_plan.json \\\n  --token $MODELSCOPE_API_TOKEN \\\n  --allow-pattern \"*.safetensors\" \\\n  --ignore-pattern \"*.tmp\"\n```\n\n计划文件默认命名为：`{repo_type}__{repo_id}.json`，其中 `/` 会替换为 `__`。\n\n2) 根据计划执行下载（download）\n\n```bash\n# 基本下载（plan 为位置参数）\nms-ipv6 download model__Qwen__Qwen2-7B-Instruct.json --local-dir ./models/\n\n# 并发与覆盖控制\nms-ipv6 download my_plan.json --local-dir ./downloads/ --workers 8 --overwrite\n\n# 超时设置（秒）\nms-ipv6 download my_plan.json --local-dir ./downloads/ --timeout 120\n```\n\n## CLI 参考\n\n提示：所有“全局选项”必须放在子命令之后使用。\n\n- 全局：\n  - `--verbose, -v` 开启详细日志\n  - `--version` 或子命令 `version` 显示版本\n\n- 生成计划：\n  - 用法：`ms-ipv6 plan [model|dataset] \u003crepo_id\u003e [--output \u003cfile\u003e] [--token \u003cTOKEN\u003e] [--allow-pattern PATTERN ...] [--ignore-pattern PATTERN ...] [-v]`\n  - 说明：\n    - `repo_id` 形如 `user/repo`\n    - 默认输出：`{repo_type}__{repo_id}.json`\n    - `--token` 可选，未提供时将从环境变量 `MODELSCOPE_API_TOKEN` 读取（当前版本暂未实际使用）\n  - 注意：未安装可选依赖 `plan` 将无法执行 `plan` 子命令\n\n- 执行下载：\n  - 用法：`ms-ipv6 download \u003cplan.json\u003e --local-dir \u003cDIR\u003e [--ipv6] [--workers N] [--overwrite] [--no-skip-existing] [--only-raw | --only-no-raw] [--timeout SEC] [-v]`\n  - 说明：\n    - `plan.json` 为位置参数\n    - `--overwrite` 优先于 `--no-skip-existing`\n    - `--only-raw` 与 `--only-no-raw` 二选一，不建议同时使用\n\n### 设计说明（为何仅下载阶段支持 IPv6）\n\n- 计划生成（plan）阶段依赖 ModelScope 主站 API/SDK，当前不支持 IPv6 直连\n- 下载（download）阶段由本工具自行发起 HTTP 请求，提供 IPv6 能力（`--ipv6`）\n\n## 示例场景\n\n下载完整模型：\n\n```bash\nms-ipv6 plan model Qwen/Qwen2-7B-Instruct\nms-ipv6 download model__Qwen__Qwen2-7B-Instruct.json --local-dir ./models/qwen2-7b/\n```\n\n仅下载权重：\n\n```bash\nms-ipv6 plan model user/model --allow-pattern \"*.safetensors\" --allow-pattern \"*.bin\"\nms-ipv6 download model__user__model.json --local-dir ./weights/\n```\n\nIPv6 环境推荐：\n\n```bash\nms-ipv6 plan model user/model\nms-ipv6 download --ipv6 model__user__model.json --local-dir ./downloads/ --only-raw -v\n```\n\n## 故障排查\n\n- 无法连通 IPv6：确认本机/网络具备 IPv6 出口；可尝试去掉 `--ipv6` 或仅测试 `--only-raw`\n- 下载很慢/超时：适度调大 `--timeout`，增加 `--workers`，或关闭 `--only-raw`\n- 403/权限问题：确认目标仓库权限或登录要求\n- 文件已存在：默认跳过；如需覆盖，添加 `--overwrite`\n\n## 开发\n\n环境要求：Python 3.8+（推荐 3.11），支持 IPv4/IPv6。\n\n安装开发依赖：\n\n```bash\npip install -e \".[dev]\"\n```\n\n质量与测试：\n\n```bash\nruff check . \u0026\u0026 ruff format .\nmypy ms_ipv6/\npytest -q\n```\n\n## 许可证\n\nMIT License\n\n## 开发：打包与上传到 PyPI\n\n本项目使用 PEP 517/518 风格打包。下面是常用脚本（位于 `scripts/`）：\n\n- `scripts/build.sh`: 清理先前构建并使用 `python -m build` 生成 `dist/` 下的 `sdist` 和 `wheel`。\n- `scripts/upload_pypi.sh`: 使用 `twine` 将 `dist/*` 上传到 PyPI。支持通过环境变量 `TWINE_REPOSITORY_URL` 指定自定义仓库。\n- `scripts/release.sh`: 先执行构建，然后可选择上传（可传 `--repository-url` 或 `--skip-upload`）。\n\n快速使用：\n\n```bash\n# 安装开发依赖（包含 build, twine）\npip install -e \".[dev]\"\n\n# 构建分发包\n./scripts/build.sh\n\n# 上传到 PyPI（或配置 ~/.pypirc），或使用环境变量：\nTWINE_USERNAME=__token__ TWINE_PASSWORD=$PYPI_API_TOKEN ./scripts/upload_pypi.sh\n\n# 一步发布（可指定 --repository-url 或 --skip-upload）\n./scripts/release.sh --repository-url https://upload.pypi.org/legacy/\n```\n\n安全提示：建议使用 PyPI API 令牌（在 `TWINE_USERNAME` 中使用 `__token__`，在 `TWINE_PASSWORD` 中使用令牌），或配置安全的 `~/.pypirc` 文件。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyanyi%2Fms_ipv6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliuyanyi%2Fms_ipv6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyanyi%2Fms_ipv6/lists"}