mirror of https://github.com/InternLM/InternLM
				
				
				
			fix(os): fix FileNotFoundError in storage_manager (#455)
* use rank0 to makedirs * use try-except to handle file error * fix cipull/464/head
							parent
							
								
									4995060d84
								
							
						
					
					
						commit
						f77f376fd6
					
				| 
						 | 
				
			
			@ -662,8 +662,11 @@ class LocalClient(StorageClient):
 | 
			
		|||
    def sync_upload_fileobj(fp: str, saved_obj=None, **kwargs):
 | 
			
		||||
        assert saved_obj is not None
 | 
			
		||||
        fp_dirname = os.path.dirname(fp)
 | 
			
		||||
        if not os.path.exists(fp_dirname):
 | 
			
		||||
            os.makedirs(fp_dirname, exist_ok=True)
 | 
			
		||||
        try:
 | 
			
		||||
            if not os.path.exists(fp_dirname):
 | 
			
		||||
                os.makedirs(fp_dirname, exist_ok=True)
 | 
			
		||||
        except FileNotFoundError:
 | 
			
		||||
            pass
 | 
			
		||||
        torch.save(saved_obj, fp, **kwargs)
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue