boostcampaitech2 / mrc-level2-nlp-04

mrc-level2-nlp-04 created by GitHub Classroom
4 stars 5 forks source link

Automatic Mixed Precision(AMP) 테스트 #11

Open kimziont opened 2 years ago

kimziont commented 2 years ago

0. 유용한 사전지식

🔔 The components on GPU memory

  1. model weights
  2. forward activations saved for gradient computation
  3. gradients
  4. optimizer state

🔔 If we look at what’s happening with FP16 training (mixed precision)

  1. forward activations saved for gradient computation are in half-precision
  2. gradients are computed in half-precision but converted to full-precision for the update
  3. optimizer states are in full precision as all the updates are done in full-precision

🔔내 생각

1. 실험 목적

AMP를 적용하면 메모리에 저장해야 하는 값들 중 선택적으로 32비트의 floating point가 아니라 16비트로 저장할 수 있습니다. 그리고 그 결과로 더 큰 batch size를 적용할 수 있기에 빠른 학습 속도와, 성능 개선을 기대할 수 있습니다.

2. 실험 세팅

🔔 fp16_backend는 apex와 amp 두 가지가 있는데, APEX(A Pytorch Extention)는 최근 파이토치 버전에서는 더이상 지원하지 않는 것으로 보이며, 굳이 사용을 위해서는 따로 설치를 비롯한 귀찮은 작업들이 있는 것으로 보임, 그러나 huggingface에서 amp를 사용할 것을 권장하므로 APEX에 대한 별도의 실험을 진행하지 않았음

3. 실험 결과

fp16_test

4. 참고 자료

  1. huggingface transformers라이브러리의 TrainingArgumentes클래스
  2. NVIDIA에서 발표 때 작성한 자료