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

advanced_source/ddp pipeline.py 번역 #428

Merged
merged 4 commits into from
Feb 2, 2022

Conversation

spongebob03
Copy link
Contributor

라이선스 동의

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

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

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

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

관련 이슈 번호

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

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

PR 종류

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

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

PR 설명

이 PR로 무엇이 달라지는지 대략적으로 알려주세요.
advanced_source/ddp pipeline.py 문서 지문 번역했습니다. 주석 번역도 곧 추가하겠습니다.

`파이프라인 병렬화 <https://pytorch.org/docs/stable/pipeline.html>`__
를 사용하여 여러 GPU에 걸친 거대한 트랜스포머(transformer) 모델을 어떻게 학습시키는지 보여줍니다.
이번 튜토리얼은 `NN.TRANSFORMER 와 TORCHTEXT 로 시퀀스-투-시퀀스(SEQUENCE-TO-SEQUENCE) 모델링하기 <https://tutorials.pytorch.kr/beginner/transformer_tutorial.html>`__ 의
확장판이며 파이프라인 병렬화가 어떻게 트랜스포머 모델 학습에 쓰이는지 증명하기 위해 이전 튜토리얼에서의
Copy link
Contributor

Choose a reason for hiding this comment

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

분산 데이터 병럴 처리 라는 말이 빠졌다는 생각이 듭니다.

Suggested change
확장판이며 파이프라인 병렬화가 어떻게 트랜스포머 모델 학습에 쓰이는지 증명하기 위해 이전 튜토리얼에서의
확장판이며 분산 데이터 병럴 처리와 파이프라인 병렬화가 어떻게 트랜스포머 모델 학습에 쓰이는지 증명하기 위해 이전 튜토리얼에서의

@@ -1,35 +1,36 @@
"""
Training Transformer models using Distributed Data Parallel and Pipeline Parallelism
====================================================================================
분산 데이터 병렬 처리와 파이프라인 병렬화를 사용한 트랜스포머 모델 학습
Copy link
Contributor

Choose a reason for hiding this comment

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

advanced_source/torch-script-parallelism.rst
여기에서는 Parallelism이 병렬 처리라고 되어 있는데 여기에는 병렬화라고 번역이 되어 있군요.
개별 문서 내에선 의미가 통하지만 전체적으로는 조금씩 불일치가 보여
parallel, parallelism 이라는 용어를 정리해야 될 필요는 있겠군요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

피드백 주셔서 감사합니다! 짚어주신 것처럼 컴퓨터 프로세스 부분에서 병럴처리로 배웠는데 병렬화라는 용어는 어색한거 같네요. 따라서 Pipeline Parallelism병렬 처리 파이프라인으로 수정했습니다. 더 나은 용어로 수정이 필요할거 같아서 Pipeline Parallelism에 대한 용어정리를 용어집에 추가하도록 건의해보겠습니다.

# the two can be summed. Here, we use ``sine`` and ``cosine`` functions of
# different frequencies.
# ``PositionalEncoding`` 모듈은 시퀀스에서 토큰의 상대적, 절대 위치에 대한
# 일부 정보를 주입합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

일부 정보라는 뜻은 위치 정보 중의 일부분만 시퀀스에 주입한다는 느낌이 들기도 하는군요.
상대적 이라는 단어와 쌍을 갖추게 뒤쪽에도 적을 붙여서 절대적 이라고 쓰면 어떨까 싶기도 합니다.
상대적, 절대적 위치에 대한 몇몇 정보 정도는 어떠신지요.

# `분산 데이터 병럴 처리 <https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html>`__
# 를 사용하여 이 파이프라인의 두 복제를 훈련시킵니다. 한 프로세스는
# GPUs 0, 1에 거쳐 파이프를 구동하고 다른 프로세스는 GPUs 2, 3에서 파이프를 구동합니다. 그 다음, 이 두
# 프로세스는 분산 데이터 병렬처리로 두 복제본을 학습시킵니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

자세히는 모르지만, 분산 환경에서 레플리카라는 것이 복제품이면서 예비용으로 데이터를 백업해 둔다는 의미 등
여러가지 의미를 가지는 용어라서 원본 뉘앙스를 유지하기 위해
복제본(replica) 이렇게 원문을 추가해 주면 어떨지요.

# `nn.TransformerEncoder <https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoder.html>`__ 계층(layer)에 포함됩니다.
# `nn.TransformerEncoder <https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoder.html>`__ 는
# `nn.TransformerEncoderLayer <https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoderLayer.html>`__ 의 ``nlayers`` 로 구성되어 있습니다.
# 결과적으로, ``nn.TransformerEncoder`` 에 중점을 두고 있으며
Copy link
Contributor

Choose a reason for hiding this comment

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

our focus를 번역하여 사용하면 한국어에서는 자주 쓰이지 않는 우리의 관심사는~ 이런 식으로 쓰여
생략을 하신 것이 잘 되었다고 생각합니다.
약간 문장을 순화시키자면 이 튜토리얼 내부에서 nn.TransformerEncoder 집중한다는 의미를 강조하기 위해
튜토리얼 이라는 단어를 해당 문장의 주어로 삽입하면 어떨까 싶습니다.

결과적으로, 이 튜토리얼에서는 ``nn.TransformerEncoder`` 에 중점을 두고 있으며

# 결과적으로, ``nn.TransformerEncoder`` 에 중점을 두고 있으며
# ``nn.TransformerEncoderLayer`` 의 절반은 한 GPU에 두고
# 나머지 절반은 다른 GPU에 있도록 모델을 분할합니다. 이를 위해서 ``Encoder`` 와
# ``Decoder`` 섹션을 분리된 모듈로 빼낸 다음, 원본 트랜스포머 모듈을
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

Choose a reason for hiding this comment

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

오 진짜 이 부분 번역이 매끄럽네요!

# ``get_batch()`` 함수는 트랜스포머 모델을 위한 입력과 타겟 시퀀스를
# 생성합니다. 이 함수는 소스 데이터를 ``bptt`` 길이를 가진 덩어리로 세분화합니다.
# 언어 모델링 과제를 위해서, 모델은
# 다음 단어인 ``Target`` 이 필요합니다. 에를 들어 ``bptt`` 의 값이 2라면,
Copy link
Contributor

Choose a reason for hiding this comment

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

예를 들어 오타가 있군요.

# It should be noted that the chunks are along dimension 0, consistent
# with the ``S`` dimension in the Transformer model. The batch dimension
# ``N`` is along dimension 1.
#
Copy link
Contributor

Choose a reason for hiding this comment

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

잘못된 공백이 삽입된 것 같습니다.

# with the ``S`` dimension in the Transformer model. The batch dimension
# ``N`` is along dimension 1.
#
# 청크가 차원 0을 속하며
Copy link
Contributor

Choose a reason for hiding this comment

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

차원 0에 속하며 가 더 부드러운 표현이 아닐까 싶네요.

# ``N`` is along dimension 1.
#
# 청크가 차원 0을 속하며
# 트랜스포머 모델의 ''S'' 차원과 일치한다는 것을 유의해야 합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

S를 감싸고 있는 따옴표가 원문은 backtick인데 번역문엔 single quoto가 쓰였습니다.
문장 제일 뒤에 공백도 한 칸 추가되어 있네요.

# transformer layers (``nn.TransformerEncoderLayer``). This creates a model with
# **~1 billion** parameters.
# 파이프라인 병렬화를 활용한 대형 트랜스포머 모델 학습을 증명하기 위해,
# 트랜스포머 계층 규모를 적절히 확장시킵니다. We use an embedding
Copy link
Contributor

Choose a reason for hiding this comment

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

원문을 안지우셨군요.

# **~1 billion** parameters.
# 파이프라인 병렬화를 활용한 대형 트랜스포머 모델 학습을 증명하기 위해,
# 트랜스포머 계층 규모를 적절히 확장시킵니다. We use an embedding
# 4096차원의 임베딩 벡터, 4096의 은닉 사이즈, 16개의 어텐션 헤드(attention head)와 총 8 개의
Copy link
Contributor

Choose a reason for hiding this comment

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

어텐션 헤드(attention head)와 뒤에 공백이 두 칸이군요.
하나는 삭제하셔도 될 것 같습니다.

# `RPC 프레임워크 <https://pytorch.org/docs/stable/rpc.html>`__ 를 초기화해야 합니다.
# Pipe는 `RRef <https://pytorch.org/docs/stable/rpc.html#rref>`__ 를 통해 RPC 프레임워크에 의존하는데
# 이는 향후 호스트 파이프라인을 교차 확장할 수 있도록 하기 때문입니다.
# 이때 RPC 프레임워크는 오직 하나의 하나의 worker로 초기화를 해야 하는데,
Copy link
Contributor

Choose a reason for hiding this comment

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

문장 마지막에 공백이 들어가 있군요.

# transformer layers on the other GPU. One pipe is setup across GPUs 0 and 1 and
# another across GPUs 2 and 3. Both pipes are then replicated using DistributedDataParallel.
# 그런 다음 파이프라인은 한 GPU에 8개의 트랜스포머와
# 다른 GPU에 8개의 트랜스포머 레이어로 초기화됩니다. 한 파이프는 GPU 0, 1에 거쳐 설정되고
Copy link
Contributor

Choose a reason for hiding this comment

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

위에서 레이어를 계층이라는 단어로 번역하셔서 계층이라는 단어를 일관성 있게 쓰는게 어떨까요.
처음 8개의 트랜스포머와 에서도 계층 관련해서 설명하고 있기 때문에 계층이라는 단어를 집어 넣어
명확하게 해 주는게 어떨까 싶습니다.

한 GPU에 8개의 트랜스포머 계층과 다른 GPU에 8개의 트랜스포머 계층으로 초기화됩니다.

# another across GPUs 2 and 3. Both pipes are then replicated using DistributedDataParallel.
# 그런 다음 파이프라인은 한 GPU에 8개의 트랜스포머와
# 다른 GPU에 8개의 트랜스포머 레이어로 초기화됩니다. 한 파이프는 GPU 0, 1에 거쳐 설정되고
# 다른 하나는 GPU 2, 3에 설정됩니다. 그런 다음 분산 데이터 병렬을 사용하여 두 파이프가 모두 복제됩니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

DistributedDataParallel 이게 클래스 이름이라서 원문을 유지해야 될 거 같습니다.

@des00
Copy link
Contributor

des00 commented Jan 28, 2022

오래간만에 번역 작업을 하신걸 보니 반갑군요.
간단하게 리뷰 의견 남겨드립니다.

@codingbowoo codingbowoo self-requested a review January 29, 2022 04:36
Copy link
Member

@codingbowoo codingbowoo left a comment

Choose a reason for hiding this comment

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

긴 문서 번역하느라 수고하셨습니다.
번역이 까다로운 부분이 많았을 것 같은데 전반적으로 수월하게 읽을 수 있었습니다.
오탈자나 대소문자, 일부 번역을 리뷰했으니 확인해보시면 좋겠습니다.
정말 수고하셨습니다! 👍


이 튜토리얼은 `분산 데이터 병렬처리(Distributed Data Parallel) <https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html>`__ 와
`병렬 처리 파이프라인 <https://pytorch.org/docs/stable/pipeline.html>`__
를 사용하여 여러 GPU에 걸친 거대한 트랜스포머(transformer) 모델을 어떻게 학습시키는지 보여줍니다.
Copy link
Member

Choose a reason for hiding this comment

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

transformer라는 말이 해당 문서에는 처음 등장하기도 하고, 모델명으로 사용되어서 처음 t를 대문자로 표기하는게 더 좋을 것 같습니다.
transformer -> Transformer

원문에서도 Transformer model 을 표기할 때는 늘 대문자로 표기하는 것으로 보입니다.
(소문자로 표기하는 경우도 있는데, transformer layer 혹은 transformer blocks 로 사용될 때네요.)

이 튜토리얼은 `분산 데이터 병렬처리(Distributed Data Parallel) <https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html>`__ 와
`병렬 처리 파이프라인 <https://pytorch.org/docs/stable/pipeline.html>`__
를 사용하여 여러 GPU에 걸친 거대한 트랜스포머(transformer) 모델을 어떻게 학습시키는지 보여줍니다.
이번 튜토리얼은 `NN.TRANSFORMER 와 TORCHTEXT 로 시퀀스-투-시퀀스(SEQUENCE-TO-SEQUENCE) 모델링하기 <https://tutorials.pytorch.kr/beginner/transformer_tutorial.html>`__ 의
Copy link
Member

Choose a reason for hiding this comment

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

이 부분도 본문과 동일하게 대소문자 규칙을 가져가는 것이 어떨까요?

  • nn.Transformer 와 TorchText 로 시퀀스-투-시퀀스(Sequence-to-Sequence) 모델링하기

연결해서 넘어가는 페이지에 전체 대문자로 제목이 적혀 있어서 이렇게 적어 주신 것으로 생각되는데요(최고!),
영문 웹사이트에서도 본문에 사용될 때는 대소문자를 모두 사용하고, 클릭해서 본문으로 넘어갔을 때는 전체 대문자로 제목이 적혀 있네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

제안해주신 표기로 수정하니 참고 문서 제목에 대해 더 잘 인식할 수 있는거 같습니다. 피드백 감사합니다!

`병렬 처리 파이프라인 <https://pytorch.org/docs/stable/pipeline.html>`__
를 사용하여 여러 GPU에 걸친 거대한 트랜스포머(transformer) 모델을 어떻게 학습시키는지 보여줍니다.
이번 튜토리얼은 `NN.TRANSFORMER 와 TORCHTEXT 로 시퀀스-투-시퀀스(SEQUENCE-TO-SEQUENCE) 모델링하기 <https://tutorials.pytorch.kr/beginner/transformer_tutorial.html>`__ 의
확장판이며 분산 데이터 병렬 처리와 병렬 처리 파이프라인이 어떻게 트랜스포머 모델 학습에 쓰이는지 증명하기 위해 이전 튜토리얼에서의
Copy link
Member

Choose a reason for hiding this comment

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

증명하기 위해 는 어감이 강하기도 하고(뭔가 수식이 와르르 있어야 할 것 같은 느낌... 저만 그럴수도요...^^;) ,
의미상으로도 보여주기 위해 / 설명하기 위해 등이 더 적절할 것 같습니다.


* `Pipeline Parallelism <https://pytorch.org/docs/stable/pipeline.html>`__
* `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://tutorials.pytorch.kr/beginner/transformer_tutorial.html>`__
* `Getting Started with Distributed Data Parallel <https://tutorials.pytorch.kr/intermediate/ddp_tutorial.html>`__
* `NN.TRANSFORMER 와 TORCHTEXT 로 시퀀스-투-시퀀스(SEQUENCE-TO-SEQUENCE) 모델링하기 <https://tutorials.pytorch.kr/beginner/transformer_tutorial.html>`__
Copy link
Member

Choose a reason for hiding this comment

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

위와 동일한 대소문자 표현을 제안드립니다.

  • nn.Transformer 와 TorchText 로 시퀀스-투-시퀀스(Sequence-to-Sequence) 모델링하기

# ``PositionalEncoding`` 모듈은 시퀀스에서 토큰의 상대적, 절대적 위치에 대한
# 몇몇 정보를 주입합니다.
# 위치 인코딩은 임베딩과 같은 차원을 가지므로
# 둘을 합칠 수 있습니다. 여기서, 주파수가 다른 ``sine`` 과 ``cosine`` 기능을
Copy link
Member

Choose a reason for hiding this comment

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

여기서 function은 기능 이라기보다는 함수 로 보입니다.

# single process to drive multiple GPUs.
# `RPC 프레임워크 <https://pytorch.org/docs/stable/rpc.html>`__ 를 초기화해야 합니다.
# Pipe는 `RRef <https://pytorch.org/docs/stable/rpc.html#rref>`__ 를 통해 RPC 프레임워크에 의존하는데
# 이는 향후 호스트 파이프라인을 교차 확장할 수 있도록 하기 때문입니다.
Copy link
Member

Choose a reason for hiding this comment

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

호스트 파이프라인을 교차 확장할 수 있도록 해주는게 RRef 라는 점이 더 잘 드러나야 할 것 같습니다.

  • Pipe가 향후 호스트 파이프라인을 교차 확장할 수 있도록 해주는 RRef <https://pytorch.org/docs/stable/rpc.html#rref>__ 를 통해 RPC 프레임워크에 의존하기 때문입니다.

는 어떠실까요? (마크다운 문법때문에 블록이 생기네요)

# learning rate is set to 5.0. `StepLR <https://pytorch.org/docs/master/optim.html?highlight=steplr#torch.optim.lr_scheduler.StepLR>`__ is
# applied to adjust the learn rate through epochs. During the
# training, we use
# 손실(loss)을 추적하기 위해 `CrossEntropyLoss <https://pytorch.org/docs/master/nn.html?highlight=crossentropyloss#torch.nn.CrossEntropyLoss>`__ 가
Copy link
Member

Choose a reason for hiding this comment

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

용어집에 loss는 손실로 정의되어있어서, 이 부분은 영문 표기를 병기하지 않아도 괜찮을 것 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

제안해주신 대로 좀 더 간결하게 서술할 수 있을거 같습니다. 다만 용어집에 있는 용어 중 문서 상에 처음으로 등장하는 용어는 영문과 함께 표기하였습니다. 문서를 읽는 사용자는 저장소의 용어집을 모를 수 있으니 손실의 경우 아래 참고 코드에서 loss, total_loss등으로 쓰여서 처음 등장할 떄 같이 표기해주는 것이 참고 코드 이해에 좀 더 나을거 같았습니다. 같이 짚어주신 부분들도 이러한 이유로 유지하는건 어떨까요..?

Copy link
Member

Choose a reason for hiding this comment

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

네 좋습니다 :)

# applied to adjust the learn rate through epochs. During the
# training, we use
# 손실(loss)을 추적하기 위해 `CrossEntropyLoss <https://pytorch.org/docs/master/nn.html?highlight=crossentropyloss#torch.nn.CrossEntropyLoss>`__ 가
# 적용되며, 옵티마이저(optimizer)로서 `SGD <https://pytorch.org/docs/master/optim.html?highlight=sgd#torch.optim.SGD>`__
Copy link
Member

Choose a reason for hiding this comment

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

용어집에 옵티마이저는 음차 표기 하는 것으로 정의되어 영문 표기 병기하지 않아도 괜찮을 것 같습니다.

# 손실(loss)을 추적하기 위해 `CrossEntropyLoss <https://pytorch.org/docs/master/nn.html?highlight=crossentropyloss#torch.nn.CrossEntropyLoss>`__ 가
# 적용되며, 옵티마이저(optimizer)로서 `SGD <https://pytorch.org/docs/master/optim.html?highlight=sgd#torch.optim.SGD>`__
# 는 확률적 경사하강법(stochastic gradient descent method)을 구현합니다. 초기
# 학습률(learning rate)은 5.0로 설정됩니다. `StepLR <https://pytorch.org/docs/master/optim.html?highlight=steplr#torch.optim.lr_scheduler.StepLR>`__ 는
Copy link
Member

Choose a reason for hiding this comment

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

용어집에 따라 영문 표기를 병기하지 않아도 괜찮을 것 같습니다.

# 적용되며, 옵티마이저(optimizer)로서 `SGD <https://pytorch.org/docs/master/optim.html?highlight=sgd#torch.optim.SGD>`__
# 는 확률적 경사하강법(stochastic gradient descent method)을 구현합니다. 초기
# 학습률(learning rate)은 5.0로 설정됩니다. `StepLR <https://pytorch.org/docs/master/optim.html?highlight=steplr#torch.optim.lr_scheduler.StepLR>`__ 는
# 에폭(epoch)에 따라서 학습률을 조절하는 데 사용됩니다. 학습하는 동안,
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
Contributor

@des00 des00 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@codingbowoo codingbowoo left a comment

Choose a reason for hiding this comment

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

좋습니다 :) 수고하셨습니다!

@9bow 9bow merged commit 788affe into PyTorchKorea:master Feb 2, 2022
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.

None yet

4 participants