Skip to content
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

Update autograd_saved_tensors_hooks_tutorial.py #598

Merged
merged 4 commits into from
Sep 15, 2022

Conversation

stella-oh
Copy link
Contributor

@stella-oh stella-oh commented Sep 6, 2022

라이선스 동의

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

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

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

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

관련 이슈 번호

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

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

PR 종류

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

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

PR 설명

이 PR로 무엇이 달라지는지 대략적으로 알려주세요.

Copy link
Contributor

@bub3690 bub3690 left a comment

Choose a reason for hiding this comment

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

번역들이 아래 줄로 적혀있습니다.

영문을 지우고 다시 적어주셔야 합니다.

Copy link
Contributor

@bub3690 bub3690 left a comment

Choose a reason for hiding this comment

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

문법이 깨진 부분이 많아 보입니다.

빌드 부탁드립니다.

@@ -103,28 +115,32 @@ def f(x):
# .. figure:: https://user-images.githubusercontent.com/8019486/130124570-f1074098-1bb3-459e-bf5a-03bf6f65b403.png
# :width: 500
# :align: center

# .. 그림 :: https://user-images.githubusercontent.com/8019486/130124570-f1074098-1bb3-459e-bf5a-03bf6f65b403.png
Copy link
Contributor

Choose a reason for hiding this comment

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

.. figure
:width

이 부분들은 문법이라 번역을 하면 안될 것으로 보이네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵.. 감사합니다. 반영하겠습니다.

@@ -503,10 +564,13 @@ def forward(self, *args, **kwargs):
# should be saved (here, those whose number of elements is greater than
# 1000) and how to combine this feature with ``nn.DataParallel``.
#
# 이 마지막 예에서는
# 반드시 저장해야하며 이 기능을 ``nn.DataParallel``와 어떻게 조합하는 텐서들에 대해 어떻게 필터하는지에 대한 증명을 해보았습니다.
Copy link
Contributor

@bub3690 bub3690 Sep 6, 2022

Choose a reason for hiding this comment

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

`` 앞뒤로 뛰어쓰기가 있어야 합니다.
빌드해서 확인 부탁드립니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵.. 감사합니다. 반영하겠습니다.

@stella-oh stella-oh requested a review from bub3690 September 6, 2022 11:56
@hyoyoung hyoyoung added the 컨트리뷰톤 오픈소스 컨트리뷰톤 관련 이슈/PR label Sep 9, 2022
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.

번역이 완료된 영어 부분은 제거 부탁드립니다.

@@ -1,5 +1,6 @@
"""
Hooks for autograd saved tensors
미분자동화(autograd) 저장된 텐서를 위한 HOOK
Copy link
Member

Choose a reason for hiding this comment

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

Hooks를 번역 안하기로 결정하셨다면
HOOK이 아니라 Hooks를 그대로 두시는게 더 나을듯합니다

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵.. 감사합니다. 반영하겠습니다.

Copy link
Contributor

@gorae17 gorae17 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다. 이미 리뷰받으신 것처럼, 영문은 지우고 영문 위치에 번역 문장을 적은 후 make html-noplot으로 빌드 후 html 파일을 확인해보시면 결과 살펴보시는 데에 도움이 될 것 같습니다.

@@ -71,6 +82,7 @@
######################################################################
# In this example, PyTorch saves intermediary values :math:`a` and
# :math:`b` in order to compute the gradient during the backward.
# 이 예제에서 파이토치는 중간 값 :math:`a` 및 :math:`b`를 저장하여 역방향 동안 기울기를 계산합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

` 가 하나 있을 때에도 앞뒤로 띄어쓰기가 있어야 합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵.. 감사합니다. 반영하겠습니다.

@stella-oh
Copy link
Contributor Author

  1. 영문삭제
  2. 문법 깨진부분 재빌드
  3. 어퍼스트로피 사용에 대한 앞뒤 공백
  4. HOOK-> hooks(original)
    위에 대한 수정내용을 반용하여 pr했습니다.. 확인 부탁드립니다.


# 이 튜토리얼에서는 사용자가 역전파가 이론상에서 작동하는 방식에 익숙하다고 가정합니다. 아니라면, 아래의 자료를 먼저 읽어보세요.
Copy link
Contributor

Choose a reason for hiding this comment

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

원문에 충실하게 번역을 해주셨는데요. 개인적인 의견으로는 아래와 같이 수정하면 조금 더 자연스럽지 않을까하여 제안드려봅니다.
'이 튜토리얼에서는 역전파가 이루어지는 방식에 대해 독자가 이론적으로 잘 알고 있다고 가정합니다.'

# as it never copies any tensors. However, the graph can keep *references*
# to tensors that would otherwise have gone out of scope: those are
# referred to as **saved tensors**.
# 모델의 훈련은 일반적으로 가설의 추론을 위해서 실행하는 것보다 더 많은 메모리를 사용합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

가설의 추론이라는 뜻보다는 inference (classification이나 regression 같은 prediction) 측면에서 의미가 전달되는 것이 더 적합할 것 같습니다. (한국어로 표현하면 '모델을 인퍼런스하는 것보다 학습하는 과정에서 메모리가 더 많이 사용된다' 이런 뜻으로 워딩이 조금 수정되면 좋을 것 같아요!

Copy link
Member

Choose a reason for hiding this comment

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

이 부분은 @garam24 님 말씀대로 수정하는게 좋을듯합니다.
문맥상 알기가 어렵습니다



######################################################################
# Why does training a model (typically) requires more memory than evaluating it?
# (일반적으로)모델을 훈련하는데 평가보다 더 많은 메모리를 소요하게 되는 이유는 무엇일까요?
Copy link
Contributor

Choose a reason for hiding this comment

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

'메모리를 소요하게'보다 '소모하는', '필요로 하는' 등으로 수정하면 더 자연스러울 것 같아 제안 의견 드립니다.

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.

몇가지 수정사항을 더 부탁드립니다.

@@ -1,58 +1,46 @@
"""
Hooks for autograd saved tensors
미분자동화(autograd) 저장된 텐서를 위한 Hooks
=======================
Copy link
Member

Choose a reason for hiding this comment

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

길게된 제목만큼 =도 늘려주세요

# as it never copies any tensors. However, the graph can keep *references*
# to tensors that would otherwise have gone out of scope: those are
# referred to as **saved tensors**.
# 모델의 훈련은 일반적으로 가설의 추론을 위해서 실행하는 것보다 더 많은 메모리를 사용합니다.
Copy link
Member

Choose a reason for hiding this comment

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

이 부분은 @garam24 님 말씀대로 수정하는게 좋을듯합니다.
문맥상 알기가 어렵습니다

# to tensors that would otherwise have gone out of scope: those are
# referred to as **saved tensors**.
# 모델의 훈련은 일반적으로 가설의 추론을 위해서 실행하는 것보다 더 많은 메모리를 사용합니다.
# 대략적으로 말하면 파이토치는 역전파를 호출하는데 필요한 계산 그래프를 저장해야하므로 추가 메모리 사용량이 있기 때문이다 라고 말할 수 있습니다.
Copy link
Member

Choose a reason for hiding this comment

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

대략적으로 말하자면 ~ 말할 수 있습니다
라고 끝납니다 이 문장은

대략적으로 말하면 파이토치는 역전파를 호출하는데 필요한 계산 그래프를 저장해야하므로 추가 메모리 사용량이 있기 때문입니다.

정도로 수정하는게 좋을듯 합니다

# In fact, PyTorch provides an API to conveniently use those hooks (as
# well as the ability to use pinned memory).
#
# 실제로 파이토치는 이러한 후크를 편리하게 사용할 수 있는 API를 제공합니다. (고정된 메모리를 사용하는 기능도 포함.)
Copy link
Member

Choose a reason for hiding this comment

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

후크 -> hooks

#
# 예를 들어, 모든 모듈을 래핑하고 해당 텐서를 CPU에 저장하는 특별한
Copy link
Member

Choose a reason for hiding this comment

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

래핑 -> 감싸두고

# The reason the above code is bad is that we are leaking files on the
# disk and they are never cleared. Fixing this is not as trivial as it
# seems.
# 위의 코드가 나쁜 이유는 디스크는 지워지지 않습니다.
Copy link
Member

Choose a reason for hiding this comment

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

위의 코드가 나쁜 이유는 디스크에 저장된 파일이 누출되고 해당 파일을 지울수도 없기 때문입니다.

# saved tensor hooks and how they can be useful in a few scenarios to
# tradeoff memory for compute.
#
# 만일 여기까지 따라오셨다면, 축하합니다! 당신은 저장된 텐서 hooks을 어떻게 사용하는지 그리고 계산 메모리의 트레이드 오프에 있어서 몇가지 시나리오를 유용하게 사용할 수 있습니다!
Copy link
Member

Choose a reason for hiding this comment

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

계산 메모리의 트레이드 오프에 있어서 몇가지 시나리오를 유용하게 사용할 수 있습니다!

->

계산 메모리의 절충안에서 몇가지 시나리오를 유용하게 사용할 수 있습니다!

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.

good

@hyoyoung hyoyoung merged commit 04bfd08 into PyTorchKorea:master Sep 15, 2022
hyoyoung added a commit that referenced this pull request Sep 15, 2022
hyoyoung added a commit that referenced this pull request Sep 15, 2022
hyoyoung added a commit that referenced this pull request Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
컨트리뷰톤 오픈소스 컨트리뷰톤 관련 이슈/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants