Allow getting an attribute like "linear.weight
(module: torch.nn.Module, attr_name: str)
| 445 | |
| 446 | @staticmethod |
| 447 | def _recursive_getattr(module: torch.nn.Module, attr_name: str) -> torch.Tensor: |
| 448 | '''Allow getting an attribute like "linear.weight"''' |
| 449 | weight = module |
| 450 | for item in attr_name.split("."): |
| 451 | weight = getattr(weight, item) |
| 452 | return weight |
| 453 | |
| 454 | def allreduce_tied_weight_gradients(self): |
| 455 | '''All reduce the gradients of the tied weights between tied stages''' |
no outgoing calls
no test coverage detected