[Rust Frontend] Migrate to hf-hub 1.0#48575
Draft
BugenZhao wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
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.
Purpose
This draft explores migrating the Rust frontend from
hf-hub0.5 to 1.0.The implementation follows the redesigned 1.0 API:
HFClientand a typedHFRepository<RepoTypeModel>download_file().local_files_only(true)HFErrorvariants and preserve their source chainsinfo()anddownload_file()APIsllm-multimodalhf-hubfeature so the dependency graph contains onehf-hubversionBlockers
1. Rust TLS and crypto violate the workspace dependency policy
hf-hub1.0.0 has two paths that activate Rust TLS:reqwest 0.13dependency keeps reqwest's default features, which selectdefault-tls -> rustls.hf-xetdependency reachesxet-client, whose default feature isrustls-tls.reqwest 0.13'srustlsfeature selects the AWS-LC provider. As a result,cargo deny check bansfails for:rustlsaws-lc-rsaws-lc-sysThe Rust workspace deliberately uses
native-tls/OpenSSL and bans these crates inrust/deny.toml.hf-hub1.0.0 exposes no downstream feature combination that selectsnative-tlsfor both paths.2. Xet-backed cold-cache downloads stall on GCP
On a GCP GB200 host, a cold-cache download for
moonshotai/Kimi-K2.5consistently behaves as follows:tokenizer_config.jsondownloads successfully.tiktoken.modelremains at zero downloaded bytes until the test timeout.206immediately.Related upstream reports include xet-core#800 and xet-core#869. The proposal to make
hf-xetoptional was closed in huggingface/hf-hub#181.Dependency impact
The lockfile grows from 575 to 668 packages. The 93-package net increase comes from the unconditional Xet stack,
reqwest 0.13, rustls/AWS-LC, and their platform-specific dependencies.This PR will remain a draft while the two blockers above are active.
Test Plan
cd rust cargo fmt --all -- --check cargo clippy --workspace --all-targets -- -D warnings cargo nextest run --workspace cargo deny check bansCold-cache reproduction:
Test Result
cargo fmt --all -- --check: passedcargo clippy --workspace --all-targets -- -D warnings: passedcargo nextest run --workspace: 1,205 passed, 1 skippedcargo deny check bans: failed onrustls,aws-lc-rs, andaws-lc-sysas documented abovetiktoken.modelEssential Elements of an Effective PR Description Checklist