bazel: use OID as sha256 for Git LFS files to prevent unnecessary HuggingFace redownloads.

This commit is contained in:
Tarry Singh 2024-03-28 17:52:52 +00:00
parent a811b2e1e3
commit e0c8eecb79

View File

@ -82,8 +82,11 @@ def _huggingface_repository_impl(rctx):
continue
if (not includes or _glob(rctx, entry["path"], includes)):
tpl = RAW_FILE_URL_REMPLATE
if ("lfs" in entry):
is_lfs = "lfs" in entry
sha256 = ""
if (is_lfs):
tpl = LFS_FILE_URL_TEMPLATE
sha256 = entry["lfs"]["oid"]
url = tpl.format(
model = rctx.attr.model,
commit = rctx.attr.commit,
@ -94,6 +97,7 @@ def _huggingface_repository_impl(rctx):
output = entry["path"],
canonical_id = entry["oid"],
headers = headers,
sha256 = sha256,
block = False,
))