Unverified Commit df3683a2 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by GitHub
Browse files

fix (#1817)

parent 63feb47c
...@@ -513,7 +513,7 @@ class MovieLens(object): ...@@ -513,7 +513,7 @@ class MovieLens(object):
else: else:
raise NotImplementedError raise NotImplementedError
TEXT = torchtext.data.Field(tokenize='spacy') TEXT = torchtext.data.Field(tokenize='spacy', tokenizer_language='en_core_web_sm')
embedding = torchtext.vocab.GloVe(name='840B', dim=300) embedding = torchtext.vocab.GloVe(name='840B', dim=300)
title_embedding = np.zeros(shape=(self.movie_info.shape[0], 300), dtype=np.float32) title_embedding = np.zeros(shape=(self.movie_info.shape[0], 300), dtype=np.float32)
......
...@@ -332,12 +332,6 @@ def run(proc_id, n_gpus, args, devices, data): ...@@ -332,12 +332,6 @@ def run(proc_id, n_gpus, args, devices, data):
# backward # backward
optimizer.zero_grad() optimizer.zero_grad()
loss.backward() loss.backward()
if n_gpus > 1:
for param in model.parameters():
if param.requires_grad and param.grad is not None:
th.distributed.all_reduce(param.grad.data,
op=th.distributed.ReduceOp.SUM)
param.grad.data /= n_gpus
optimizer.step() optimizer.step()
if proc_id == 0: if proc_id == 0:
iter_tput.append(len(seeds) * n_gpus / (time.time() - tic_step)) iter_tput.append(len(seeds) * n_gpus / (time.time() - tic_step))
......
...@@ -207,13 +207,6 @@ def run(proc_id, n_gpus, args, devices, data): ...@@ -207,13 +207,6 @@ def run(proc_id, n_gpus, args, devices, data):
loss = loss_fcn(batch_pred, batch_labels) loss = loss_fcn(batch_pred, batch_labels)
optimizer.zero_grad() optimizer.zero_grad()
loss.backward() loss.backward()
if n_gpus > 1:
for param in model.parameters():
if param.requires_grad and param.grad is not None:
th.distributed.all_reduce(param.grad.data,
op=th.distributed.ReduceOp.SUM)
param.grad.data /= n_gpus
optimizer.step() optimizer.step()
if proc_id == 0: if proc_id == 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment