mirror of
https://github.com/open-mmlab/mmengine.git
synced 2025-06-03 21:54:44 +08:00
[Enhancement] Format the log of CheckpointLoader.load_checkpoint
(#685)
* Format log of * Fix as comment * Update mmengine/runner/checkpoint.py Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com> Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
This commit is contained in:
parent
48650f3bac
commit
6eced86f6b
@ -236,15 +236,14 @@ class CheckpointLoader:
|
||||
return cls._schemes[p]
|
||||
|
||||
@classmethod
|
||||
def load_checkpoint(cls, filename, map_location=None, logger=None):
|
||||
def load_checkpoint(cls, filename, map_location=None, logger='current'):
|
||||
"""load checkpoint through URL scheme path.
|
||||
|
||||
Args:
|
||||
filename (str): checkpoint file name with given prefix
|
||||
map_location (str, optional): Same as :func:`torch.load`.
|
||||
Default: None
|
||||
logger (:mod:`logging.Logger`, optional): The logger for message.
|
||||
Default: None
|
||||
logger (str): The logger for message. Defaults to 'current'.
|
||||
|
||||
Returns:
|
||||
dict or OrderedDict: The loaded checkpoint.
|
||||
@ -252,8 +251,10 @@ class CheckpointLoader:
|
||||
|
||||
checkpoint_loader = cls._get_checkpoint_loader(filename)
|
||||
class_name = checkpoint_loader.__name__
|
||||
print_log(f'{class_name[10:]} loads checkpoint from path: {filename}',
|
||||
logger)
|
||||
print_log(
|
||||
f'Loads checkpoint by {class_name[10:]} backend from path: '
|
||||
f'{filename}',
|
||||
logger=logger)
|
||||
return checkpoint_loader(filename, map_location)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user