-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DeepLearning] cpu, single gpu, multi gpu(data parallel, custom data parallel, distributed parallel, apex) 를 통한 학습 #7
Labels
Comments
heojae
changed the title
[DeepLearning] cpu, single gpu, multi gpu(data parallel, custom data parallel, distributed parallel, apex) 를 통한 학습결과 정리
[DeepLearning] cpu, single gpu, multi gpu(data parallel, custom data parallel, distributed parallel, apex) 를 통한 학습
Feb 7, 2021
GPU 메모리 할당 자세히 살펴보기Single Gpu
|
Nvidia Apex이부분의 환경설정은 https://github.com/NVIDIA/apex 에 있는대로 참고하여, 거의 균등하게, GPU 상에 메모리가 잡히는 것을 확인할 수 있었지만,
또한,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
작성 계기
당근 마켓, pytorch multi gpu 학습 제대로 하기
이 글을 읽고, 단순히, 학습코드를 구현하는 것보다는 좀 더 다양한 경우에 맞게 코드를 작성하는 것이 맞다고 생각하여, 시도하게 되었습니다.
또한, Multi GPU 를 다루는 방법에 대해서, 더 공부를 하고 싶었고,
이번 기회를 통해서,
pytorch
의multi gpu
를 다루는 방법에 대해서, 좀 더 깊게 이해할 수 있는 시간이 되었습니다.참고자료
https://pytorch.org/tutorials/beginner/blitz/data_parallel_tutorial.html
https://pytorch.org/tutorials/intermediate/dist_tuto.html
https://pytorch.org/tutorials/intermediate/ddp_tutorial.html
참고 gihub
https://github.com/zhanghang1989/PyTorch-Encoding/blob/master/encoding/parallel.py
https://github.com/pytorch/examples/blob/master/imagenet/main.py
https://github.com/NVIDIA/apex/blob/master/examples/imagenet/main_amp.py
추천자료
https://yangkky.github.io/2019/07/08/distributed-pytorch-tutorial.html
Paper(좀더 심화적으로 이해하고 싶을 경우, 읽어보세요.)
https://arxiv.org/pdf/2006.15704.pdf
Train Acc 와 Test Acc 그리고 Batch Size 실험
cpu - only
batch_size =1
아래와 같이, 학습의 속도가 더딘 것을 확인할 수 있으며,
5 epoch 가 지난후,
train_acc
는99 ~ 100
에 가까이 수렴한 것에 비해,test_acc
는58-61
에 머물러 있는 것을 확인할 수 있었습니다.분석
이에 대해서 분석해보았을 때,
local minimum
에 빠졌다고, 판단할 수 있었습니다.batch size =1
이기 때문에, 이미지input
한개 한개 에 대해서, 많은 영향을 받을 수 밖에 없으며,또한, 이와 같은 환경에서, 여러번 실험 해보았으나, 각
epoch
마다,accuracy
가 10-20% 이상 증가하고, 감소 하는것으로 보아local minimum
에 빠져, 위와 같은 결과가 나온것이라 판단합니다.접기/펼치기 버튼
batch_size = 16
batch_size=1
과는 다르게, 빠른 속도로 학습이 되어가는 것을 확인할 수 있었습니다.5 epoch
를 학습하였지만,train_acc
는95 ~ 96
에 가까이 수렴하였고,test_acc
는96~97
가까이 올라간 것을 확인할 수 있었습니다.접기/펼치기 버튼
single-gpu
batch_size = 32, epoch =20
아래와 같이, test_accuracy 가 이미 충분히 수렴을 한것을 확인할 수 있었습니다.
train_acc
는99
에 가까이 수렴하는 등, noise 를 고려한다면, 이미 충분히 수렴을 하였고,test_acc
는99.457
에 수렴한 것으로 보아, 더 이상 학습은 무의미하다고 판단을 하였기에앞으로는, GPU Memory 할당을 중점적으로 살펴보겠습니다.
접기/펼치기 버튼
The text was updated successfully, but these errors were encountered: