Skip to content

Commit d185d64

Browse files
TNingabetlen
andauthored
fix: handle additional from_pretrained files in subfolders (abetlen#2085)
* Fixed issue abetlen#1938 Now using the correct path * fix: handle additional from_pretrained files in subfolders * docs: update changelog for from_pretrained subfolder fix --------- Co-authored-by: abetlen <abetlen@gmail.com>
1 parent f1bfa11 commit d185d64

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- fix: handle additional `from_pretrained` files in subfolders by @TNing in #2085
11+
1012
## [0.3.25]
1113

1214
- feat: Update llama.cpp to ggml-org/llama.cpp@210a6570c by @abetlen in #2242

llama_cpp/llama.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,12 +2396,15 @@ def from_pretrained(
23962396
)
23972397

23982398
(matching_additional_file,) = matching_additional_files
2399+
additional_subfolder = str(Path(matching_additional_file).parent)
2400+
additional_file_name = Path(matching_additional_file).name
23992401

2400-
# download the additional file
2402+
# Split additional file paths independently to avoid duplicating
2403+
# the main model subfolder in Hugging Face download URLs.
24012404
hf_hub_download(
24022405
repo_id=repo_id,
2403-
filename=matching_additional_file,
2404-
subfolder=subfolder,
2406+
filename=additional_file_name,
2407+
subfolder=additional_subfolder,
24052408
local_dir=local_dir,
24062409
local_dir_use_symlinks=local_dir_use_symlinks,
24072410
cache_dir=cache_dir,

0 commit comments

Comments
 (0)