File size: 2,853 Bytes
17c6d62 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
β οΈ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->
# Trainer [[trainer]]
[`Trainer`] ν΄λμ€λ PyTorchμμ μμ ν κΈ°λ₯(feature-complete)μ νλ ¨μ μν APIλ₯Ό μ 곡νλ©°, λ€μ€ GPU/TPUμμμ λΆμ° νλ ¨, [NVIDIA GPU](https://nvidia.github.io/apex/), [AMD GPU](https://rocm.docs.amd.com/en/latest/rocm.html)λ₯Ό μν νΌν© μ λ°λ, κ·Έλ¦¬κ³ PyTorchμ [`torch.amp`](https://pytorch.org/docs/stable/amp.html)λ₯Ό μ§μν©λλ€. [`Trainer`]λ λͺ¨λΈμ νλ ¨ λ°©μμ 컀μ€ν°λ§μ΄μ¦ν μ μλ λ€μν μ΅μ
μ μ 곡νλ [`TrainingArguments`] ν΄λμ€μ ν¨κ» μ¬μ©λ©λλ€. μ΄ λ ν΄λμ€λ ν¨κ» μμ ν νλ ¨ APIλ₯Ό μ 곡ν©λλ€.
[`Seq2SeqTrainer`]μ [`Seq2SeqTrainingArguments`]λ [`Trainer`]μ [`TrainingArguments`] ν΄λμ€λ₯Ό μμνλ©°, μμ½μ΄λ λ²μκ³Ό κ°μ μνμ€-ν¬-μνμ€ μμ
μ μν λͺ¨λΈ νλ ¨μ μ ν©νκ² μ‘°μ λμ΄ μμ΅λλ€.
<Tip warning={true}>
[`Trainer`] ν΄λμ€λ π€ Transformers λͺ¨λΈμ μ΅μ νλμ΄ μμΌλ©°, λ€λ₯Έ λͺ¨λΈκ³Ό ν¨κ» μ¬μ©λ λ μμμΉ λͺ»ν λμμ νκ² λ μ μμ΅λλ€. μμ λ§μ λͺ¨λΈμ μ¬μ©ν λλ λ€μμ νμΈνμΈμ:
- λͺ¨λΈμ νμ ννμ΄λ [`~utils.ModelOutput`]μ μλΈν΄λμ€λ₯Ό λ°νν΄μΌ ν©λλ€.
- λͺ¨λΈμ `labels` μΈμκ° μ 곡λλ©΄ μμ€μ κ³μ°ν μ μκ³ , λͺ¨λΈμ΄ ννμ λ°ννλ κ²½μ° κ·Έ μμ€μ΄ ννμ 첫 λ²μ§Έ μμλ‘ λ°νλμ΄μΌ ν©λλ€.
- λͺ¨λΈμ μ¬λ¬ κ°μ λ μ΄λΈ μΈμλ₯Ό μμ©ν μ μμ΄μΌ νλ©°, [`Trainer`]μκ² μ΄λ¦μ μ리기 μν΄ [`TrainingArguments`]μμ `label_names`λ₯Ό μ¬μ©νμ§λ§, κ·Έ μ€ μ΄λ κ²λ `"label"`λ‘ λͺ
λͺ
λμ΄μλ μ λ©λλ€.
</Tip>
## Trainer [[transformers.Trainer]]
[[autodoc]] Trainer
- all
## Seq2SeqTrainer [[transformers.Seq2SeqTrainer]]
[[autodoc]] Seq2SeqTrainer
- evaluate
- predict
## TrainingArguments [[transformers.TrainingArguments]]
[[autodoc]] TrainingArguments
- all
## Seq2SeqTrainingArguments [[transformers.Seq2SeqTrainingArguments]]
[[autodoc]] Seq2SeqTrainingArguments
- all
|