From ef84c0884132fea696b5b6fe6e17b6fc0954e30d Mon Sep 17 00:00:00 2001 From: lucasdelimanogueira Date: Sat, 1 Jun 2024 20:55:02 -0300 Subject: [PATCH] fix backward reduce distributed --- README.md | 2 +- norch/nn/parallel.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1d13be..a6491be 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Project details explanations can also be found on [medium](https://towardsdatasc **PyNorch** is a deep learning framework constructed using C/C++, CUDA and Python. This is a personal project with educational purpose only! `Norch` means **NOT** PyTorch, and we have **NO** claims to rivaling the already established PyTorch. The main objective of **PyNorch** was to give a brief understanding of how a deep learning framework works internally. It implements the Tensor object, GPU support and an automatic differentiation system. # 2 - Installation -Install this package from PyPi (you can test on Colab! Also tested on AWS p3 instances ami-00f1d513c2bb78c75) +Install this package from PyPi (you can test on Colab!) ```css $ pip install norch diff --git a/norch/nn/parallel.py b/norch/nn/parallel.py index 7d5060b..16eca59 100644 --- a/norch/nn/parallel.py +++ b/norch/nn/parallel.py @@ -13,8 +13,11 @@ class DistributedDataParallel(Module): def backward(self): self.module.backward() - for module, name, parameter in self.parameters(): + for module, name, _ in self.parameters(): + parameter = getattr(module, name) dist.allreduce_mean_tensor(parameter) + setattr(module, name, parameter) +