def METHOD_NAME(self):
    device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
    model = ToyModel2().to(device)
    runner = Runner(
        model=model,
        train_dataloader=dict(
            dataset=DummyDataset(),
            sampler=dict(type='DefaultSampler', shuffle=True),
            batch_size=3,
            num_workers=0),
        val_dataloader=dict(
            dataset=DummyDataset(),
            sampler=dict(type='DefaultSampler', shuffle=False),
            batch_size=3,
            num_workers=0),
        val_evaluator=[ToyMetric1()],
        work_dir=self.temp_dir.name,
        default_scope='mmdet',
        optim_wrapper=OptimWrapper(
            torch.optim.Adam(ToyModel().parameters())),
        train_cfg=dict(by_epoch=True, max_epochs=2, val_interval=1),
        val_cfg=dict(),
        default_hooks=dict(logger=None),
        custom_hooks=[dict(type='MeanTeacherHook')],
        experiment_name='test1')
    runner.train()
    self.assertTrue(
        osp.exists(osp.join(self.temp_dir.name, 'epoch_2.pth')))
    # checkpoint = torch.load(osp.join(self.temp_dir.name, 'epoch_2.pth'))
    # load and testing
    runner = Runner(
        model=model,
        test_dataloader=dict(
            dataset=DummyDataset(),
            sampler=dict(type='DefaultSampler', shuffle=True),
            batch_size=3,
            num_workers=0),
        test_evaluator=[ToyMetric1()],
        test_cfg=dict(),
        work_dir=self.temp_dir.name,
        default_scope='mmdet',
        load_from=osp.join(self.temp_dir.name, 'epoch_2.pth'),
        default_hooks=dict(logger=None),
        custom_hooks=[dict(type='MeanTeacherHook')],
        experiment_name='test2')
    runner.test()
    @MODEL_WRAPPERS.register_module()
    class DummyWrapper(BaseModel):
        def __init__(self, model):
            super().__init__()
            self.module = model
        def forward(self, *args, **kwargs):
            return self.module(*args, **kwargs)
    # with model wrapper
    runner = Runner(
        model=DummyWrapper(ToyModel2()),
        test_dataloader=dict(
            dataset=DummyDataset(),
            sampler=dict(type='DefaultSampler', shuffle=True),
            batch_size=3,
            num_workers=0),
        test_evaluator=[ToyMetric1()],
        test_cfg=dict(),
        work_dir=self.temp_dir.name,
        default_scope='mmdet',
        load_from=osp.join(self.temp_dir.name, 'epoch_2.pth'),
        default_hooks=dict(logger=None),
        custom_hooks=[dict(type='MeanTeacherHook')],
        experiment_name='test3')
    runner.test()