I am trying to train the global model by receiving gradients from distributed devices. But, the model’s weight is not updated. I have no idea…Thanks in advance.
mod = Model()
cp = torch.load(rep)
mod.load_state_dict(cp[’ model_state_dic’ ])
optimizer = optim.Adam(mod.parameters(), lr=0.001)
optimizer.load_state_dict(cp[‘optimizer_state_dict’])
G = ComputeGradient()
mod.train()
for u in range(len(G)):
optimizer.zero_grad()
loss = Variable(G[u], requires_grad=True)
loss.backward()
optimizer.step()