You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which means ALL GPUs' results get synchronized here. For instance, when my batch size is 128, i have 2 GPU to train the model and before the code above, every output's 0th dimension is 64, half of 128. And after this code block, they will be aggregated and output's size will be 128. So, when we get loss value in main_task, there is only a scalar tensor. Looks like there is no need to use "loss.mean()".
I have some print results:
ifn_gpu>1:
print(loss)
print(loss.size())
loss=loss.mean() # mean() to average on multi-gpu.print(loss)
print(loss.size())
The text was updated successfully, but these errors were encountered:
In main_task_retrieval.py, fuction "train_epoch", we can see:
But in modeling.py, there is:
which means ALL GPUs' results get synchronized here. For instance, when my batch size is 128, i have 2 GPU to train the model and before the code above, every output's 0th dimension is 64, half of 128. And after this code block, they will be aggregated and output's size will be 128. So, when we get loss value in main_task, there is only a scalar tensor. Looks like there is no need to use "loss.mean()".
I have some print results:
The text was updated successfully, but these errors were encountered: