mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-06-22 05:29:36 +00:00
fix module utils bug (#1066)
This commit is contained in:
parent
a00644079e
commit
6754f1b77f
@ -14,7 +14,7 @@ def register_colo_module(module_type: type, colo_module: ColoModule):
|
||||
def is_colo_module(module: torch.nn.Module):
|
||||
global _COLOSSAL_MODULES
|
||||
for module_type in _COLOSSAL_MODULES.keys():
|
||||
if isinstance(type(module), module_type):
|
||||
if isinstance(module, module_type):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -23,7 +23,7 @@ def get_colo_module(module: torch.nn.Module):
|
||||
global _COLOSSAL_MODULES
|
||||
if is_colo_module(module):
|
||||
for module_type, colo_module in _COLOSSAL_MODULES.items():
|
||||
if isinstance(type(module), module_type):
|
||||
if isinstance(module, module_type):
|
||||
return colo_module
|
||||
else:
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user