Skip to content

feat(sync): modelscope 点号转义目录自动补原名软链 - #161

Merged
KadenZhang3321 merged 1 commit into
mainfrom
feat/modelscope-dot-escape-symlink
Nov 27, 2026
Merged

KadenZhang3321 merged 1 commit into
mainfrom
feat/modelscope-dot-escape-symlink

Conversation

@KadenZhang3321

Copy link
Copy Markdown
Collaborator

resolve https://github.com/opensourceways/backlog/issues/2647

问题

modelscope SDK 把模型名里的 . 转义成 ___ 落缓存目录(如 Eco-Tech/Qwen3.5-27B-w8a8-mtp → Qwen3___5-27B-w8a8-mtp)。业务 job 若按原名直引路径(/root/.cache/modelscope/hub/models/Eco-Tech/Qwen3.5-27B-w8a8-mtp)会找不到权重。gy001 盘上历史上靠人工补软链(2026-03-27 那批 Qwen3.5-* -> Qwen3___5-* 即人工产物),新下载无人补就会踩坑。

改动

download-json-models.sh:modelscope 下载成功后(未指定 local_dir 且名字含 .),在缓存目录下 find 所有 <org>/<转义名> 实体目录,旁侧 ln -sfn 补原名→转义名的相对软链:

  • 相对链接,任意挂载视角(业务容器 /root/.cache、同步机 /mnt/sfs_turbo)都成立;
  • 幂等:重跑 ln -sfn 原地覆盖同目标链接;
  • 保护:原名处若已有非软链实体(真实目录/文件),WARN 跳过,绝不覆盖;
  • 覆盖两种布局:$cache/models/<org>/<san>(1.37 经典)与 $cache/hub/models/<org>/<san>(legacy_materialize 目标),audit 的三种路径模式深度都在 maxdepth 4 内。

测试

  • bash -n ✓;
  • 单测:双布局各建一实体目录 → 两条软链生成 ✓;原名处放真实目录 → WARN 跳过、实体保留 ✓;重跑幂等 ✓(见 commit 说明,测试树已清理)。

存量

modelscope escapes '.' in model names to '___' in cache dirs; business jobs
that reference the original name path (e.g. gy001
Eco-Tech/Qwen3.5-27B-w8a8-mtp) miss the weights. After a successful
modelscope download, create a relative symlink <original> -> <escaped> next
to every escaped dir found under the cache (idempotent; real non-symlink
entity at the original path is preserved with a WARN, never overwritten).

resolve https://github.com/opensourceways/backlog/issues/2647
@KadenZhang3321
KadenZhang3321 force-pushed the feat/modelscope-dot-escape-symlink branch from b7efa2f to f615f47 Compare November 27, 2026 03:44
@KadenZhang3321
KadenZhang3321 merged commit 752a142 into main Nov 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant