Skip to content

Commit

Permalink
[Fix] Support compare numpy array dataset meta (#511)
Browse files Browse the repository at this point in the history
* [Fix] Support compare numpy array dataset meta

* Add comment
  • Loading branch information
HAOCHENYE committed Sep 22, 2022
1 parent 2e99ea3 commit 8d14eb6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mmengine/runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import os
import os.path as osp
import pickle
import platform
import time
import warnings
Expand Down Expand Up @@ -1919,7 +1920,11 @@ def resume(self,

resumed_dataset_meta = checkpoint['meta'].get('dataset_meta', None)
dataset_meta = getattr(self.train_dataloader.dataset, 'metainfo', None)
if resumed_dataset_meta != dataset_meta:

# `resumed_dataset_meta` and `dataset_meta` could be object like
# np.ndarray, which cannot be directly judged as equal or not,
# therefore we just compared their dumped results.
if pickle.dumps(resumed_dataset_meta) != pickle.dumps(dataset_meta):
warnings.warn(
'The dataset metainfo from the resumed checkpoint is '
'different from the current training dataset, please '
Expand Down

0 comments on commit 8d14eb6

Please sign in to comment.