Skip to content

Commit

Permalink
enable mmap in torch.load (#2479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mddct authored Apr 15, 2024
1 parent c9bc0aa commit b1dadcb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wenet/utils/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

def load_checkpoint(model: torch.nn.Module, path: str) -> dict:
logging.info('Checkpoint: loading from checkpoint %s' % path)
checkpoint = torch.load(path, map_location='cpu')
checkpoint = torch.load(path, map_location='cpu', mmap=True)
missing_keys, unexpected_keys = model.load_state_dict(checkpoint,
strict=False)
for key in missing_keys:
Expand Down

0 comments on commit b1dadcb

Please sign in to comment.