mirror of
https://github.com/KohakuBlueleaf/KohakuHub.git
synced 2026-07-15 18:25:09 -05:00
[GH-ISSUE #18] [Feature]: Xet protocol support (chunk-level dedup) #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Dynoooooo on GitHub (May 21, 2026).
Original GitHub issue: https://github.com/KohakuBlueleaf/KohakuHub/issues/18
What feature do you want?
Add support for HF's Xet content-addressable storage protocol alongside (or eventually replacing) Git LFS for large file handling. That means content-defined chunking, xorbs as upload containers, and shards for file reconstruction — see the upload protocol spec.
Reference implementation is open source: xet-core (Rust client + CAS logic). The huggingface_hub Python client already speaks it via hf_xet, so a Xet-compatible KohakuHub endpoint would Just Work with existing tooling.
Why do you need it?
Two reasons:
Compatibility drift. HF made Xet the default for all new accounts/orgs as of May 23, 2025 (Hub docs). Any KohakuHub instance mirroring or falling back to huggingface.co will increasingly hit Xet-backed repos. LFS-only means relying on HF's legacy LFS bridge indefinitely.
Chunk-level vs file-level dedup. LFS dedupes whole files; Xet dedupes bytes. When a checkpoint or dataset changes incrementally, only modified chunks move. HF reports 2-3x faster transfers in production (From Chunks to Blocks). Big deal for anyone iterating on models, and for storage costs on the host side.
Additional context
The protocol is being standardized at the IETF via draft-denis-xet-03, so this isn't an HF-exclusive thing going forward.
Good news on the KohakuHub side: a lot of the pieces are already in place — S3 backend, LakeFS versioning, SHA256 content-addressing. Adding Xet would mostly mean layering CDC chunking + xorb assembly on top of the existing storage layer rather than a rewrite.
Totally get it if this is out of scope for alpha. Just wanted to log it. Happy to help test once anything lands. Thanks for building this!
Checklist
@normanheckscher commented on GitHub (Jul 11, 2026):
Can confirm this gap from the client side, for what it's worth.
I've been running a mirror pipeline that pulls from huggingface.co and pushes into a self-hosted KohakuHub instance using
huggingface_hub's standardupload_folder()/snapshot_download(). A few things I hit that might be useful data points:/api/{repo_type}s/{repo_id}/xet-write-token/{revision}— confirms there's currently no server-side path for Xet-aware clients to negotiate an upload at all, not just a slower/fallback one.HF_HUB_DISABLE_XETdoesn't reliably re-decide mid-process. Oncehuggingface_hubis imported, toggling that env var in the same process and retrying doesn't change xet-on-vs-off for subsequent calls — I had to shell out to a fresh subprocess with the var set beforehuggingface_hubgets imported to reliably force LFS. Worth knowing if anyone else is debugging "I set the env var and it's still trying Xet" — it's not a bug in your app code, it's an import-time decision on the client side.hf_xetinstalled (as expected, since huggingface.co speaks Xet) — the gap is specifically upload-to-KohakuHub.Not offering a fix, just a workaround (force-disable Xet before the upload leg, always fall back to LFS) plus these repro details in case they save someone time. Repo's here if useful: https://github.com/normanheckscher/hf2kh. Thanks for building this either way!