mirror of
				https://github.com/facebookresearch/sam2.git
				synced 2025-11-04 11:32:12 +08:00 
			
		
		
		
	Merge pull request #2 from kit1980/patch-1
Use `weights_only` for loading
This commit is contained in:
		
						commit
						52198ead0e
					
				@ -135,7 +135,7 @@ def build_sam2_video_predictor_hf(model_id, **kwargs):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def _load_checkpoint(model, ckpt_path):
 | 
					def _load_checkpoint(model, ckpt_path):
 | 
				
			||||||
    if ckpt_path is not None:
 | 
					    if ckpt_path is not None:
 | 
				
			||||||
        sd = torch.load(ckpt_path, map_location="cpu")["model"]
 | 
					        sd = torch.load(ckpt_path, map_location="cpu", weights_only=True)["model"]
 | 
				
			||||||
        missing_keys, unexpected_keys = model.load_state_dict(sd)
 | 
					        missing_keys, unexpected_keys = model.load_state_dict(sd)
 | 
				
			||||||
        if missing_keys:
 | 
					        if missing_keys:
 | 
				
			||||||
            logging.error(missing_keys)
 | 
					            logging.error(missing_keys)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user