HarryVolek / PyTorch_Speaker_Verification

PyTorch implementation of "Generalized End-to-End Loss for Speaker Verification" by Wan, Li et al.
BSD 3-Clause "New" or "Revised" License
576 stars 164 forks source link

Change the code to use multi-gpu, but can not speed up the training. #65

Open Naminwang opened 4 years ago

Naminwang commented 4 years ago

Use DataParallel model to start a multi-gpu training, change the config.yaml batch size, can not speed up the training.

mindmapper15 commented 4 years ago

I've also tried multi-gpus and had same issue with you. Then I found the biggest overhead is in GE2ELoss part. Especially get cosine similarity matrix and calculate loss part.

https://github.com/HarryVolek/PyTorch_Speaker_Verification/blob/11b1d1932b0a226de9cabd8652c0c2ea1446611f/utils.py

Just copy and paste this codes to your utils.py. I don't know why author didn't have merged this codes yet, but it is much faster than original codes.

Naminwang commented 4 years ago

I've also tried multi-gpus and had same issue with you. Then I found the biggest overhead is in GE2ELoss part. Especially get cosine similarity matrix and calculate loss part.

https://github.com/HarryVolek/PyTorch_Speaker_Verification/blob/11b1d1932b0a226de9cabd8652c0c2ea1446611f/utils.py

Just copy and paste this codes to your utils.py. I don't know why author didn't have merged this codes yet, but it is much faster than original codes.

Thank you very much, I will try to use the code in the link.