[Tensor] activation is an attr of ColoTensor (#897)

This commit is contained in:
Jiarui Fang
2022-04-28 14:43:22 +08:00
committed by GitHub
parent e76f76c08b
commit 676f191532
4 changed files with 51 additions and 35 deletions

View File

@@ -94,7 +94,10 @@ class ColoInitContext(InsertPostInitMethodToModuleSubClasses):
save_torch_payload = True if not self._lazy_memory_allocate else False
for name, param in name_list:
delattr(module, name)
setattr(module, name,
ColoTensor.init_from_torch_tensor(tensor=param.to(self._device), save_payload=save_torch_payload))
setattr(
module, name,
ColoTensor.init_from_torch_tensor(tensor=param.to(self._device),
save_payload=save_torch_payload,
is_model_data=True))
ColoModulize(module)