Skip to content

🌐 [i18n-KO] Translated ko-chapter3-4.mdx to Korean #1031

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Youngdong2
Copy link
Contributor

What does this PR do?

Translated the ko-chapter3-4.mdx file of the documentation to Korean.
Thank you in advance for your review.

Part of huggingface/transformers#20179

Before reviewing

  • Check for missing / redundant translations (번역 누락/중복 검사)
  • Grammar Check (맞춤법 검사)
  • Review or Add new terms to glossary (용어 확인 및 추가)
  • Check Inline TOC (e.g. [[lowercased-header]])
  • Check live-preview for gotchas (live-preview로 정상작동 확인)

Who can review? (Initial)

May you please review this PR?

@harheem, @nsbg, @Youngdong2, @xhaktm00, @ssunbear, @ChoHyoungSeo, @Judy-Choi

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review? (Final)

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@nsbg nsbg left a comment

Choose a reason for hiding this comment

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

문서 내용이 꽤나 길어서 번역하는 데 시간이 좀 걸리셨을 것 같네요 ㅠㅠ 수고하셨습니다!


### 훈련 준비[[prepare-for-training]]

실제로 훈련 루프를 작성하기 전에 몇 가지 객체를 정의해야 합니다. 첫 번째는 배치를 반복하는 데 사용할 데이터로더입니다. 하지만 이러한 데이터로더를 정의하기 전에 `tokenized_datasets`에 약간의 후처리를 적용해야 합니다. 이는 `Trainer`가 자동으로 수행했던 작업들을 직접 처리하기 위해서입니다. 구체적으로 다음과 같은 작업이 필요합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

큰 변화는 아니지만 '실제로 훈련 루프를 작성하기 전에'를 '실제 훈련 루프를 작성하기 전에'로 수정하는 게 좀 더 자연스럽게 읽히는 느낌이 드는 것 같아 제안 드립니다!

tokenized_datasets["train"].column_names
```

그런 다음 결과에 모델이 허용할 컬럼만 있는지 확인할 수 있습니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분이 개인적으로는 직역 느낌이 강한 것 같은데 어떤 표현이 좋을지 고민되네요 🤔


모든 🤗 Transformers 모델은 `labels`가 제공될 때 손실을 반환하며, 로짓도 얻습니다(배치의 각 입력에 대해 2개씩, 따라서 8 x 2 크기의 텐서).

훈련 루프를 작성할 준비가 거의 완료되었습니다! 옵티마이저와 학습률 스케줄러 두 가지만 빠졌습니다. `Trainer`가 수행한 작업을 수동으로 복제하려고 하므로 동일한 기본값을 사용하겠습니다. `Trainer`에서 사용하는 옵티마이저는 `AdamW`로, 가중치 감소 정규화에 대한 변형이 있는 Adam과 동일합니다(Ilya Loshchilov와 Frank Hutter의 ["Decoupled Weight Decay Regularization"](https://arxiv.org/abs/1711.05101) 참조)
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

Choose a reason for hiding this comment

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

위 제안대로 수정하면 좋을 것 같습니다~


</Tip>

마지막으로, 기본적으로 사용되는 학습률 스케줄러는 최대값(5e-5)에서 0까지의 선형 감소입니다. 이를 올바르게 정의하려면 수행할 훈련 단계 수를 알아야 하는데, 이는 실행하려는 에포크 수에 훈련 배치 수(훈련 데이터로더의 길이)를 곱한 것입니다. `Trainer`는 기본적으로 3개의 에포크를 사용하므로 이를 따르겠습니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

옵티마이저 설명 관련 부분과 통일성을 위해 '마지막으로' 표현을 빼도 괜찮지 않을까? 하는 생각이 드네요..!


### 훈련 루프[[the-training-loop]]

마지막으로 한 가지 더 고려할 점이 있습니다. GPU를 사용할 수 있다면 GPU를 활용하는 것이 좋습니다(CPU에서는 훈련이 몇 분 대신 몇 시간이 걸릴 수 있거든요). 이를 위해 모델과 배치를 배치할 `device`를 정의하겠습니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

CPU에서는 훈련이 몇 분 대신 몇 시간이 걸릴 수 있거든요 → CPU 환경에서는 훈련에만 몇 시간이 걸릴 수 있기 때문입니다

아니면 괄호 내용을 아예 빼서

CPU 환경에서는 훈련에 몇 시간이 걸릴 수 있기 때문에 GPU를 사용할 수 있다면 ~~

이것도 자연스럽게 읽히는 것 같습니다!


<Tip>

💡 **최신 훈련 최적화**: 훈련 루프를 더욱 효율적으로 만들려면 다음을 고려하세요.
Copy link
Contributor

Choose a reason for hiding this comment

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

'더욱 효율적인 훈련 루프를 위해 다음을 고려하세요.'

{'accuracy': 0.8431372549019608, 'f1': 0.8907849829351535}
```

다시 말하지만, 모델 헤드 초기화의 무작위성과 데이터 셔플링으로 인해 결과가 약간 다를 수 있지만 같은 수준이어야 합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

문맥상 '비슷한 수준'이 좀 더 자연스러울 것 같기도 합니다..!


추가할 첫 번째 줄은 import 줄입니다. 두 번째 줄은 환경을 살펴보고 적절한 분산 설정을 초기화하는 `Accelerator` 객체를 인스턴스화합니다. 🤗 Accelerate는 장치 배치를 처리하므로 모델을 장치에 올리는 줄을 제거할 수 있습니다(또는 원한다면 `device` 대신 `accelerator.device`를 사용하도록 변경할 수 있습니다).

그런 다음 주요 작업은 데이터로더, 모델, 옵티마이저를 `accelerator.prepare()`에 보내는 줄에서 수행됩니다. 이는 분산 훈련이 의도한 대로 작동하도록 적절한 컨테이너에서 해당 객체들을 래핑합니다. 수행해야 할 나머지 변경 사항은 배치를 `device`에 올리는 줄을 제거하고(다시, 유지하고 싶다면 `accelerator.device`를 사용하도록 변경하기만 하면 됩니다) `loss.backward()`를 `accelerator.backward(loss)`로 바꾸는 것입니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

다시, 유지하고 싶다면 → 다시 유지하고 싶다면

progress_bar.update(1)
```

이것을 `train.py` 스크립트에 넣으면 모든 종류의 분산 설정에서 실행할 수 있는 스크립트가 됩니다. 분산 설정에서 시도해보려면 다음 명령을 실행하세요.
Copy link
Contributor

Choose a reason for hiding this comment

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

이 코드를 train.py 스크립트에 추가하면


모든 🤗 Transformers 모델은 `labels`가 제공될 때 손실을 반환하며, 로짓도 얻습니다(배치의 각 입력에 대해 2개씩, 따라서 8 x 2 크기의 텐서).

훈련 루프를 작성할 준비가 거의 완료되었습니다! 옵티마이저와 학습률 스케줄러 두 가지만 빠졌습니다. `Trainer`가 수행한 작업을 수동으로 복제하려고 하므로 동일한 기본값을 사용하겠습니다. `Trainer`에서 사용하는 옵티마이저는 `AdamW`로, 가중치 감소 정규화에 대한 변형이 있는 Adam과 동일합니다(Ilya Loshchilov와 Frank Hutter의 ["Decoupled Weight Decay Regularization"](https://arxiv.org/abs/1711.05101) 참조)

Choose a reason for hiding this comment

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

'가중치 감소 정규화에 대한 변형이 있는 Adam과 동일합니다'
문장이 한번에 읽히지 않아서 조금 다듬어도 좋을 것 같아요!

(좀 더 간결하게)
"Adam과 같지만 가중치 감소 정규화에 변화를 준 방식입니다"
(기술 문서 톤)
"Adam과 동일하되, 가중치 감소 정규화에서 변형된 형태입니다"

Copy link

@Judy-Choi Judy-Choi left a comment

Choose a reason for hiding this comment

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

영동님 긴 문서 번역하시느라 넘나 고생많으셨어요! ❤️‍🔥

correct: true
},
{
text: "코드에서 GPU 수를 지정해야 합니다.",

Choose a reason for hiding this comment

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

Suggested change
text: "코드에서 GPU 수를 지정해야 합니다.",
text: "코드에서 GPU 갯수를 지정해야 합니다.",

Copy link

@Judy-Choi Judy-Choi left a comment

Choose a reason for hiding this comment

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

approve 반영 안 된 것 같아서 댓글 한번 더 남깁니다! 고생많으셨어요 영동님!

Copy link
Contributor

@harheem harheem left a comment

Choose a reason for hiding this comment

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

안녕하세요 영동님! 이전 튜토리얼 문서 번역에 이어 이번에도 튜토리얼 문서 번역해주셔서 정말 진심으로 감사드립니다 ㅎㅎㅎ

고생많으셨고, 팀원 분들이 좋은 리뷰 많이 남겨주셔서 반영해서 제안 사항 정리해보았습니다.
다른 문서였으면 이렇게까지 꼼꼼하게 리뷰하진 않을 것 같은데, LLM 코스 문서가 강의 문서다보니 더 꼼꼼하고 이해하기 쉽게 작성되면 좋을 것 같아 이것저것 남겨보았습니다.

확인해주시고 반영해주시면 좋을 것 같아요 🤗✨


### 훈련 준비[[prepare-for-training]]

실제로 훈련 루프를 작성하기 전에 몇 가지 객체를 정의해야 합니다. 첫 번째는 배치를 반복하는 데 사용할 데이터로더입니다. 하지만 이러한 데이터로더를 정의하기 전에 `tokenized_datasets`에 약간의 후처리를 적용해야 합니다. 이는 `Trainer`가 자동으로 수행했던 작업들을 직접 처리하기 위해서입니다. 구체적으로 다음과 같은 작업이 필요합니다.
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
실제로 훈련 루프를 작성하기 전에 몇 가지 객체를 정의해야 합니다. 첫 번째는 배치를 반복하는 데 사용할 데이터로더입니다. 하지만 이러한 데이터로더를 정의하기 전에 `tokenized_datasets`에 약간의 후처리를 적용해야 합니다. 이는 `Trainer`가 자동으로 수행했던 작업들을 직접 처리하기 위해서입니다. 구체적으로 다음과 같은 작업이 필요합니다.
훈련 루프를 본격적으로 작성하기 전에 몇 가지 객체를 정의해야 합니다. 첫 번째는 배치를 반복하는 데 사용할 데이터로더입니다. 하지만 이러한 데이터로더를 정의하기 전에 `tokenized_datasets`에 약간의 후처리를 적용해야 합니다. 이는 `Trainer`가 자동으로 수행했던 작업들을 직접 처리하기 위해서입니다. 구체적으로 다음과 같은 작업이 필요합니다.


실제로 훈련 루프를 작성하기 전에 몇 가지 객체를 정의해야 합니다. 첫 번째는 배치를 반복하는 데 사용할 데이터로더입니다. 하지만 이러한 데이터로더를 정의하기 전에 `tokenized_datasets`에 약간의 후처리를 적용해야 합니다. 이는 `Trainer`가 자동으로 수행했던 작업들을 직접 처리하기 위해서입니다. 구체적으로 다음과 같은 작업이 필요합니다.

- 모델이 예상하지 않는 값에 해당하는 컬럼을 제거합니다(`sentence1` 및 `sentence2` 컬럼 등).
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
- 모델이 예상하지 않는 값에 해당하는 컬럼을 제거합니다(`sentence1``sentence2` 컬럼 등).
- 모델이 예상하지 않는 값에 해당하는 열(예: `sentence1``sentence2` 등)을 제거합니다.

https://terms.tta.or.kr/dictionary/dictionaryView.do?word_seq=061799-1
'컬럼'으로 번역할지 '열'로 번역할지 정말 고민이 됐는데요, TTA 기준으로 '열'로 번역하는 것이 좋을 것 같습니다!

progress_bar.update(1)
```

추가할 첫 번째 줄은 import 줄입니다. 두 번째 줄은 환경을 살펴보고 적절한 분산 설정을 초기화하는 `Accelerator` 객체를 인스턴스화합니다. 🤗 Accelerate는 장치 배치를 처리하므로 모델을 장치에 올리는 줄을 제거할 수 있습니다(또는 원한다면 `device` 대신 `accelerator.device`를 사용하도록 변경할 수 있습니다).
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
추가할 첫 번째 줄은 import 줄입니다. 두 번째 줄은 환경을 살펴보고 적절한 분산 설정을 초기화하는 `Accelerator` 객체를 인스턴스화합니다. 🤗 Accelerate는 장치 배치를 처리하므로 모델을 장치에 올리는 줄을 제거할 수 있습니다(또는 원한다면 `device` 대신 `accelerator.device`를 사용하도록 변경할 수 있습니다).
추가할 첫 번째 줄은 import 줄입니다. 두 번째 줄은 환경을 살펴보고 적절한 분산 설정을 초기화하는 `Accelerator` 객체를 인스턴스화합니다. 🤗 Accelerate는 장치 배치를 처리하므로, 모델을 특정 장치에 올리는 코드를 제거할 수 있습니다. 또는 `device` 대신 `accelerator.device`를 사용하도록 변경할 수 있습니다.

Co-authored-by: Harheem Kim <[email protected]>
Co-authored-by: Judy <[email protected]>
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.

5 participants