Skip to content

Commit

Permalink
[Fix] when run load pretain with local_files_only, local variable 'ca…
Browse files Browse the repository at this point in the history
…ched_folder' referenced before assignment (huggingface#9376)

Fix local variable 'cached_folder' referenced before assignment in hub_utils.py

Fix when use `local_files_only=True` with `subfolder`, local variable 'cached_folder' referenced before assignment issue.

Co-authored-by: YiYi Xu <[email protected]>
  • Loading branch information
RobinXL and yiyixuxu authored Oct 15, 2024
1 parent 9d06161 commit 79b118e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/diffusers/utils/hub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def _get_checkpoint_shard_files(
local_dir=cache_dir, subfolder=subfolder, original_shard_filenames=original_shard_filenames
)
if subfolder is not None:
cached_folder = os.path.join(cached_folder, subfolder)
cached_folder = os.path.join(cache_dir, subfolder)

return cached_folder, sharded_metadata

Expand Down

0 comments on commit 79b118e

Please sign in to comment.