fix(model-store): 接受 HF tree API 返回的裸 LFS oid,修复本地模型下载失败 - #1072
Merged
Merged
Conversation
huggingface.co 与 hf-mirror.com 的 /api/models/{repo}/tree 接口里 lfs.oid
是不带 sha256: 前缀的 64 位十六进制,现有解析只认前缀形式,导致本地模型
下载直接报 unsupported Hugging Face LFS oid。
2.0 起 parse_lfs_sha256 只接受 sha256: 前缀,但 huggingface.co 与 hf-mirror.com 的 tree 接口返回的是裸 64 位十六进制,导致下载 Qwen3-ASR 等本地模型时直接报 unsupported Hugging Face LFS oid。改为前缀可选, 仍校验 64 位十六进制。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
2.0 beta 下载本地模型(如 Qwen3-ASR 0.6B)时直接失败,界面报
unsupported Hugging Face LFS oid。原因是parse_lfs_sha256只接受sha256:<hex>形式,而 huggingface.co 与 hf-mirror.com 的/api/models/{repo}/tree/main接口返回的lfs.oid是不带前缀的 64 位十六进制。该解析在 #1019 引入;原有单测的 fixture 用的是带前缀的写法,所以没有暴露问题。修复 / 新增 / 改进
parse_lfs_sha256:sha256:前缀改为可选,仍校验 64 位十六进制并转小写。hf_tree_accepts_bare_lfs_oid_from_live_api,fixture 取自 2026-09-13 两个接口对Qwen/Qwen3-ASR-0.6B的真实返回。原有带前缀的单测保留不动。兼容
测试计划
unsupported Hugging Face LFS oid,与界面报错一致。cargo test -p openless-coretauri dev,默认 huggingface 源:unsupported Hugging Face LFS oid.openless-model-ready已写),model.safetensors的 sha256 与 HF 公布的79d6cbd4…3ea一致cargo fmt -p openless-core --check在api.rs上有 diff,beta 上本来就有,本 PR 未改动该文件。