Skip to content

Commit

Permalink
remove mock
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoXing1996 committed Aug 21, 2023
1 parent 8367a55 commit 2625855
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions tests/test_models/test_archs/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ def test_build(self):
from mmagic.models.editors.ddpm.denoising_unet import SiLU
torch.nn.SiLU = SiLU

# mock torch.device for pt<2.0.0
_orig_device_fn = torch.device
if digit_version(TORCH_VERSION) < digit_version('2.0.0'):

def mock_fn(device):
if device == 'meta':
return _orig_device_fn('cpu')
else:
return _orig_device_fn(device)

torch.device = mock_fn

# 1. test from config
model = MODELS.build(
dict(type='ControlNetModel', from_config=config_path))
Expand Down Expand Up @@ -121,5 +109,3 @@ def mock_fn(device):
model.registrer_buffer('buffer', 123)
called_args, _ = register_buffer_mock.call_args
self.assertEqual(called_args, ('buffer', 123))

torch.device = _orig_device_fn

0 comments on commit 2625855

Please sign in to comment.