Skip to content

Conversation

@hihunjin
Copy link

라이선스 동의

변경해주시는 내용에 BSD 3항 라이선스가 적용됨을 동의해주셔야 합니다.

더 자세한 내용은 기여하기 문서를 참고해주세요.

동의하시면 아래 [ ][x]로 만들어주세요.

  • 기여하기 문서를 확인하였으며, 본 PR 내용에 BSD 3항 라이선스가 적용됨에 동의합니다.

관련 이슈 번호

이 Pull Request와 관련있는 이슈 번호를 적어주세요.

이슈 또는 PR 번호 앞에 #을 붙이시면 제목을 바로 확인하실 수 있습니다. (예. #999 )

PR 종류

이 PR에 해당되는 종류 앞의 [ ][x]로 변경해주세요.

  • 오탈자를 수정하거나 번역을 개선하는 기여
  • 번역되지 않은 튜토리얼을 번역하는 기여
  • 공식 튜토리얼 내용을 반영하는 기여
  • 위 종류에 포함되지 않는 기여

PR 설명

https://pytorch.org/tutorials/recipes/recipes/amp_recipe.html#automatic-mixed-precision
번역

@9bow 9bow requested review from 9bow, adonisues, bongmo and creduo May 25, 2021 11:37
@9bow 9bow added this to the 1.8 milestone May 25, 2021
@9bow 9bow modified the milestones: 1.8, 1.9 Jun 27, 2021
Copy link
Member

@hyoyoung hyoyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

너무 긴 문장은 2~3줄로 줄바꿈 부탁드리고,
빠진 부분이나 생략한 부분은 번역하지 않고 원문으로 둔뒤에 다음에 번역이 좋을거 같습니다

패치 자체가 길어서 리뷰가 어려우니 앞부분 잘된것은 따로 올려주시고
뒷부분에 생략이 많은 부분은 원문 그대로 보내주시면 더 빠른 처리가 될거 같습니다.

which can reduce your network's runtime and memory footprint.
`torch.cuda.amp <https://pytorch.org/docs/stable/amp.html>`_ 는 혼합 정밀도를 사용할 수 있는 편리한 메서드를 제공합니다.
정밀도는 ``torch.float32`` (``float``)과, ``torch.float16`` (``half``)를 사용하는 연산들이 있습니다.
선형 계층과 합성곱 계층들과 같은 연산들은, ``float16`` 에서 더욱 빠릅니다. reduction과 같은 연산들은 ``float32`` 의 동적인 범주 계산을 요구하기도 합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

선형 계층과 합성곱 계층들과 같은 연산들은, float16 에서 더욱 빠릅니다. reduction과 같은 연산들은 float32 의 동적인 범주 계산을 요구하기도 합니다.

Some ops와 Other ops의 의미를 살려서 번역해보면 어떨까요?

선형 계층과 합성곱 계층같은 어떤 연산들은 float16 에서 더욱 빠릅니다.
reduction같은 다른 연산들은 float32 흔히 동적인 범주 계산을 요구하기도 합니다.

You may download and run this recipe as a standalone Python script.
The only requirements are Pytorch 1.6+ and a CUDA-capable GPU.
이 레시피는 먼저 기본 정밀도에서 간단한 신경망의 성능을 측정하고, 다음으로 ``autocast`` 와 ``GradScaler`` 를 추가하여, 같은 신경망에서 향상된 성능을 살펴봅니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 레시피는 먼저 기본 정밀도에서 간단한 신경망의 성능을 측정하고, 다음으로 autocastGradScaler 를 추가하여, 같은 신경망에서 혼합된 정밀도와 향상된 성능을 살펴봅니다.

This recipe should show significant (2-3X) speedup on those architectures.
On earlier architectures (Kepler, Maxwell, Pascal), you may observe a modest speedup.
Run ``nvidia-smi`` to display your GPU's architecture.
이 레시피를 파이썬 스크립트로 다운로드하고 실행해 볼 수 있습니다. 환경은 Pytorch 1.6+와 CUDA-capable GPU가 필요합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 레시피를 단독 파이썬 스크립트로 다운로드하고 실행해 볼 수 있습니다. 환경은 Pytorch 1.6+와 CUDA-capable GPU가 필요합니다.

Run ``nvidia-smi`` to display your GPU's architecture.
이 레시피를 파이썬 스크립트로 다운로드하고 실행해 볼 수 있습니다. 환경은 Pytorch 1.6+와 CUDA-capable GPU가 필요합니다.
혼합 정밀도는 원시적으로 텐서 코어를 사용할 수 있는 아키텍처(볼타, 튜링, 암페어)에서 효과를 잘 발휘합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

primarily는 주로가 더 어울릴거 같습니다

혼합 정밀도는 주로 텐서 코어를 사용할 수 있는 아키텍처(볼타, 튜링, 암페어)에서 효과를 잘 발휘합니다.

이 레시피를 파이썬 스크립트로 다운로드하고 실행해 볼 수 있습니다. 환경은 Pytorch 1.6+와 CUDA-capable GPU가 필요합니다.
혼합 정밀도는 원시적으로 텐서 코어를 사용할 수 있는 아키텍처(볼타, 튜링, 암페어)에서 효과를 잘 발휘합니다.
이 레시피는 이 아키텍처에서 2에서 3배의 속도 향상을 보여줍니다. 이전 버전의 아키텍처(케플러, 맥스웰, 파스칼)에서는, 완만한 속도 향상을 관찰할 수 있습니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

significant와 modest의 대조적인 부분이니 significant도 포함해는게 좋을거 같습니다

이 레시피는 이 아키텍처에서 2~3배의 두드러진 속도 향상을 보여줍니다. 이전 버전의 아키텍처(케플러, 맥스웰, 파스칼)에서는, 완만한 속도 향상을 관찰할 수 있습니다.

scaler.scale(loss).backward()

# Unscales the gradients of optimizer's assigned params in-place
# Gradient를 unscale합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optimizer에 할당된 자리의 파라미터들의 Gradient를 unscale합니다.

# Since the gradients of optimizer's assigned params are now unscaled, clips as usual.
# You may use the same value for max_norm here as you would without gradient scaling.
# optimizer에 할당된 파라미터들의 gradient가 unscaled되었기 때문에, 평소처럼 클리핑을 합니다.
# max_norm을 같은 값으로 사용할 수 있습니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradient scaling없이 max_norm을 같은 값으로 사용할 수도 있습니다.

scaler.step(opt)
scaler.update()
opt.zero_grad() # set_to_none=True here can modestly improve performance
opt.zero_grad()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt.zero_grad() # set_to_none=True 여기서 약간의 성능 향상이 있습니다

# When saving, save the scaler state dict alongside the usual model and optimizer state dicts.
# Do this either at the beginning of an iteration before any forward passes, or at the end of
# an iteration after ``scaler.update()``.
# AMP를 사용한 저장/재시작은 `scaler.state_dict <https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler.state_dict>`_ 와 `scaler.load_state_dict <https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler.load_state_dict>`_ 를 사용합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 2~3줄로 줄바꿈이 좋을거 같습니다.

checkpoint = {"model": net.state_dict(),
"optimizer": opt.state_dict(),
"scaler": scaler.state_dict()}
# Write checkpoint as desired, e.g.,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분이 빠진 이유는 무엇인가요?

@hyoyoung
Copy link
Member

hyoyoung commented Nov 7, 2021

feedback이 없어서 pr을 close합니다.
필요할때 열어주시거나 새로 생성하여주세요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants