microsoft / snca.pytorch

Improving Generalization via Scalable Neighborhood Component Analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

what would be the best way to do multi-gpu training for snca?

pallashadow opened this issue · comments

Shall I do nn.parallel.DistributedDataParallel for for both "model" and "lemniscate" and mannually sync each lemniscate memory per epoch?

I think a better solution might be use a single GPU for "lemniscate" memory and calculation, while other GPUs for data parallel "model" part?

I am doing a comics image retrieval task, and find this project very useful. Thank you for you help.

Hi, I am also thinking about the memory issue, how did you deal with it?

I put the memory forward and backward on CPU, when the memory became large. it was a little bit slower but worked well.

model_forward_gpu -> memory_forward_cpu -> loss_cpu -> memory_backward_cpu -> model_backward_gpu

Thanks for sharing!