[Tensor] distributed view supports inter-process hybrid parallel (#1169)

This commit is contained in:
Jiarui Fang
2022-06-27 09:45:26 +08:00
committed by GitHub
parent 9e1daa63d2
commit aa7bef73d4
13 changed files with 101 additions and 19 deletions

View File

@@ -101,3 +101,13 @@ class ColoParameter(ColoTensor, torch.nn.Parameter):
# TODO(jzy) we don't support object reflection now.
# distspec cannot be pickled or rebuilt because it's tightly connected to runtime attribute `process_group`.
raise NotImplementedError
#### the ColoParameter should use the torch.Tensor's builtin methodes ###
def view(self, *args) -> 'ColoTensor':
return super().view_base(*args)
def size(self, *args, **kwargs) -> torch.Size:
# import inspect
# print(*['{:40}| {}:{}\n'.format(x.function, x.filename, x.lineno) for x in inspect.stack()])
return super().size_base(*args, **kwargs)