이전 블로그에서 작성했던 글

[PyTorch] model.half()


Pytorch 공식

Automatic Mixed Precision - PyTorch Tutorials 1.11.0+cu102 documentation

Automatic Mixed Precision examples - PyTorch 1.11.0 documentation


torch.cuda.amp는 mixed precision을 위한 편리한 기능을 제공하여 준다

몇몇 연산은 torch.float32(float) datatype을 사용하고, 다른 연산들은 torch.float16(half) 연산을 사용하도록

Untitled

Mixed precisoin은 각 연산에 그것에 적절한 datatype을 적용하도록 하고 네트워크의 runtime과 memory footprint를 감소시켜준다

Pytorch에서 automatic mixed precision training은 일반적으로 torch.cuda.amp.autocasttorch.cuda.amp.GradScaler을 함께 씀을 의미한다

Mixed Precision은 주로 Tensor Core-enabled architectures ( Volta, Turing, Ampere ) 에서 이점이 있다 ( Tensor core의 연산 자체가 FP16 ). 보통 2-3배 빨라질 것이다

이전의 아키텍쳐들 ( Kepler, Maxwell, Pascal ) 은 큰 속도 향상은 없을 수도 있다.

일반적인 Mixed Precision Training