updated args

This commit is contained in:
William Falcon 2019-06-26 17:49:58 -04:00
parent 1ee6d21db2
commit 71cd8f549d
2 changed files with 12 additions and 8 deletions

View File

@ -75,7 +75,8 @@ class ExampleModel(RootModule):
# return loss_val, tqdm_dic # return loss_val, tqdm_dic
output = OrderedDict({ output = OrderedDict({
'tng_loss': loss_val, 'loss': loss_val,
'tqdm_metrics': {}
}) })
return output return output

View File

@ -394,14 +394,17 @@ class Trainer(TrainerIO):
# forward pass # forward pass
# return a scalar value and a dic with tqdm metrics # return a scalar value and a dic with tqdm metrics
pdb.set_trace() output = self.model(data_batch, batch_nb, False)
if self.data_parallel:
output = self.model(data_batch, batch_nb) # when DP, we need to aggregate the scalars we received as outputs
output = reduce_distributed_output(output, len(self.data_parallel_device_ids)) # use mean as the reduce function
else: if self.data_parallel:
output = self.mode(data_batch, batch_nb) output = reduce_distributed_output(output, len(self.gpus))
pdb.set_trace()
model_specific_tqdm_metrics_dic = output['tqdm_metrics']
loss = output['loss']
loss, model_specific_tqdm_metrics_dic = self.model.training_step(data_batch, batch_nb)
self.__add_tqdm_metrics(model_specific_tqdm_metrics_dic) self.__add_tqdm_metrics(model_specific_tqdm_metrics_dic)
# backward pass # backward pass