fix broken config for GenericModel

Summary: D42760349 (9540c29023) (make Module.__init__ automatic) didn't account properly for inheritance.

Reviewed By: shapovalov

Differential Revision: D42834466

fbshipit-source-id: 53ee4c788985c1678ad905c06ccf12b2b41361e9
This commit is contained in:
Jeremy Reizenstein 2023-01-29 08:19:57 -08:00 committed by Facebook GitHub Bot
parent 7dfa6918ee
commit c8af1c45ca

View File

@ -944,7 +944,7 @@ def _fixup_class_init(some_class) -> None:
torch.nn.Module.__init__(self) torch.nn.Module.__init__(self)
getattr(self, _DATACLASS_INIT)(*args, **kwargs) getattr(self, _DATACLASS_INIT)(*args, **kwargs)
assert not hasattr(some_class, _DATACLASS_INIT) assert _DATACLASS_INIT not in some_class.__dict__
setattr(some_class, _DATACLASS_INIT, some_class.__init__) setattr(some_class, _DATACLASS_INIT, some_class.__init__)
some_class.__init__ = init some_class.__init__ = init