Unverified Commit 074798b2 authored by hlky's avatar hlky Committed by GitHub
Browse files

Fix `local_files_only` for checkpoints with shards (#10294)

parent 3ee96695
...@@ -455,7 +455,6 @@ def _get_checkpoint_shard_files( ...@@ -455,7 +455,6 @@ def _get_checkpoint_shard_files(
allow_patterns = [os.path.join(subfolder, p) for p in allow_patterns] allow_patterns = [os.path.join(subfolder, p) for p in allow_patterns]
ignore_patterns = ["*.json", "*.md"] ignore_patterns = ["*.json", "*.md"]
if not local_files_only:
# `model_info` call must guarded with the above condition. # `model_info` call must guarded with the above condition.
model_files_info = model_info(pretrained_model_name_or_path, revision=revision, token=token) model_files_info = model_info(pretrained_model_name_or_path, revision=revision, token=token)
for shard_file in original_shard_filenames: for shard_file in original_shard_filenames:
...@@ -490,14 +489,6 @@ def _get_checkpoint_shard_files( ...@@ -490,14 +489,6 @@ def _get_checkpoint_shard_files(
" again after checking your internet connection." " again after checking your internet connection."
) from e ) from e
# If `local_files_only=True`, `cached_folder` may not contain all the shard files.
elif local_files_only:
_check_if_shards_exist_locally(
local_dir=cache_dir, subfolder=subfolder, original_shard_filenames=original_shard_filenames
)
if subfolder is not None:
cached_folder = os.path.join(cache_dir, subfolder)
return cached_folder, sharded_metadata return cached_folder, sharded_metadata
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment