[diffusion] chore: fetch metadata beside nested lora weights (#36057)

This commit is contained in:
Mick
2026-08-24 11:02:23 +08:00
committed by GitHub
parent 1a368eca1c
commit 6ca872a11f
2 changed files with 6 additions and 1 deletions
@@ -663,12 +663,16 @@ def maybe_download_lora(
return os.path.join(source.local_path, selected_file)
assert source.repo_id is not None
allow_patterns = ["*.json", selected_file]
selected_parent = os.path.dirname(selected_file)
if selected_parent:
allow_patterns.insert(1, f"{selected_parent}/*.json")
local_path = maybe_download_model(
source.repo_id,
local_dir,
download,
is_lora=True,
allow_patterns=["*.json", selected_file],
allow_patterns=allow_patterns,
revision=resolved_weight.inventory.resolved_revision or source.revision,
)
target = os.path.join(local_path, selected_file)
@@ -176,6 +176,7 @@ def test_lora_tree_url_selects_one_pinned_weight(tmp_path):
assert download.call_args.kwargs["revision"] == "immutable-sha"
assert download.call_args.kwargs["allow_patterns"] == [
"*.json",
"adapters/*.json",
f"adapters/{weight_name}",
]