File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -405,20 +405,21 @@ def _get_checkpoint_shard_files(
405405    ignore_patterns  =  ["*.json" , "*.md" ]
406406    # `model_info` call must guarded with the above condition. 
407407    local  =  False 
408-     try :
409-         model_files_info  =  model_info ( pretrained_model_name_or_path ,  revision = revision ,  token = token ) 
410-     except   ConnectionError   as   e : 
411-         if   local_files_only : 
412-              temp_dir   =   snapshot_download ( 
413-                  repo_id = pretrained_model_name_or_path ,  cache_dir = cache_dir ,  local_files_only = local_files_only 
414-             ) 
415-              model_files_info   =   _get_filepaths_for_folder ( temp_dir ) 
416-             local  =  True 
417-         else :
408+     if   local_files_only :
409+         temp_dir  =  snapshot_download ( 
410+              repo_id = pretrained_model_name_or_path ,  cache_dir = cache_dir ,  local_files_only = local_files_only 
411+         ) 
412+         model_files_info   =   _get_filepaths_for_folder ( temp_dir ) 
413+         local   =   True 
414+     else : 
415+         try : 
416+             model_files_info  =  model_info ( pretrained_model_name_or_path ,  revision = revision ,  token = token ) 
417+         except   ConnectionError   as   e :
418418            raise  EnvironmentError (
419419                f"We couldn't connect to '{ HUGGINGFACE_CO_RESOLVE_ENDPOINT } { pretrained_model_name_or_path }  
420420                " again after checking your internet connection." 
421421            ) from  e 
422+ 
422423    for  shard_file  in  original_shard_filenames :
423424        if  local :
424425            shard_file_present  =  any (shard_file  in  k  for  k  in  model_files_info )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments