Skip to content

Commit 2f59c15

Browse files
authored
🌐 [i18n-KO] Translated albert.md to Korean (#39524)
* docs: ko: albert.md * feat: nmt draft * fix: manual edits
1 parent 98386dc commit 2f59c15

File tree

1 file changed

+263
-0
lines changed

1 file changed

+263
-0
lines changed

docs/source/ko/model_doc/albert.md

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
4+
the License. You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
9+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10+
specific language governing permissions and limitations under the License.
11+
12+
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
13+
rendered properly in your Markdown viewer.
14+
15+
-->
16+
17+
<div style="float: right;">
18+
<div class="flex flex-wrap space-x-1">
19+
<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&logo=pytorch&logoColor=white" >
20+
<img alt= "TensorFlow" src= "https://img.shields.io/badge/TensorFlow-FF6F00?style=flat&logo=tensorflow&logoColor=white" >
21+
<img alt= "Flax" src="https://img.shields.io/badge/Flax-29a79b.svg?style…Nu+W0m6K/I9gGPd/dfx/EN/wN62AhsBWuAAAAAElFTkSuQmCC">
22+
<img alt="SDPA" src= "https://img.shields.io/badge/SDPA-DE3412?style=flat&logo=pytorch&logoColor=white" >
23+
</div>
24+
</div>
25+
26+
# ALBERT[[albert]]
27+
28+
[ALBERT](https://huggingface.co/papers/1909.11942)[BERT](./bert)의 확장성과 학습 시 메모리 한계를 해결하기 위해 설계된 모델입니다. 이 모델은 두 가지 파라미터 감소 기법을 도입합니다. 첫 번째는 임베딩 행렬 분해(factorized embedding parametrization)로, 큰 어휘 임베딩 행렬을 두 개의 작은 행렬로 분해하여 히든 사이즈를 늘려도 파라미터 수가 크게 증가하지 않도록 합니다. 두 번째는 계층 간 파라미터 공유(cross-layer parameter sharing)로, 여러 계층이 파라미터를 공유하여 학습해야 할 파라미터 수를 줄입니다.
29+
30+
ALBERT는 BERT에서 발생하는 GPU/TPU 메모리 한계, 긴 학습 시간, 갑작스런 성능 저하 문제를 해결하기 위해 만들어졌습니다. ALBERT는 파라미터를 줄이기 위해 두 가지 기법을 사용하여 메모리 사용량을 줄이고 BERT의 학습 속도를 높입니다:
31+
32+
- **임베딩 행렬 분해:** 큰 어휘 임베딩 행렬을 두 개의 더 작은 행렬로 분해하여 메모리 사용량을 줄입니다.
33+
- **계층 간 파라미터 공유:** 각 트랜스포머 계층마다 별도의 파라미터를 학습하는 대신, 여러 계층이 파라미터를 공유하여 학습해야 할 가중치 수를 더욱 줄입니다.
34+
35+
ALBERT는 BERT와 마찬가지로 절대 위치 임베딩(absolute position embeddings)을 사용하므로, 입력 패딩은 오른쪽에 적용해야 합니다. 임베딩 크기는 128이며, BERT의 768보다 작습니다. ALBERT는 한 번에 최대 512개의 토큰을 처리할 수 있습니다.
36+
37+
모든 공식 ALBERT 체크포인트는 [ALBERT 커뮤니티](https://huggingface.co/albert) 조직에서 확인하실 수 있습니다.
38+
39+
> [!TIP]
40+
> 오른쪽 사이드바의 ALBERT 모델을 클릭하시면 다양한 언어 작업에 ALBERT를 적용하는 예시를 더 확인하실 수 있습니다.
41+
42+
아래 예시는 [`Pipeline`], [`AutoModel`] 그리고 커맨드라인에서 `[MASK]` 토큰을 예측하는 방법을 보여줍니다.
43+
44+
<hfoptions id="usage">
45+
<hfoption id="Pipeline">
46+
47+
```py
48+
import torch
49+
from transformers import pipeline
50+
51+
pipeline = pipeline(
52+
task="fill-mask",
53+
model="albert-base-v2",
54+
torch_dtype=torch.float16,
55+
device=0
56+
)
57+
pipeline("식물은 광합성이라고 알려진 과정을 통해 [MASK]를 생성합니다.", top_k=5)
58+
```
59+
60+
</hfoption>
61+
<hfoption id="AutoModel">
62+
63+
```py
64+
import torch
65+
from transformers import AutoModelForMaskedLM, AutoTokenizer
66+
67+
tokenizer = AutoTokenizer.from_pretrained("albert/albert-base-v2")
68+
model = AutoModelForMaskedLM.from_pretrained(
69+
"albert/albert-base-v2",
70+
torch_dtype=torch.float16,
71+
attn_implementation="sdpa",
72+
device_map="auto"
73+
)
74+
75+
prompt = "식물은 [MASK]이라고 알려진 과정을 통해 에너지를 생성합니다."
76+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
77+
78+
with torch.no_grad():
79+
outputs = model(**inputs)
80+
mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
81+
predictions = outputs.logits[0, mask_token_index]
82+
83+
top_k = torch.topk(predictions, k=5).indices.tolist()
84+
for token_id in top_k[0]:
85+
print(f"예측: {tokenizer.decode([token_id])}")
86+
```
87+
88+
</hfoption>
89+
<hfoption id="transformers CLI">
90+
91+
```bash
92+
echo -e "Plants create [MASK] through a process known as photosynthesis." | transformers run --task fill-mask --model albert-base-v2 --device 0
93+
```
94+
95+
</hfoption>
96+
97+
</hfoptions>
98+
99+
## 참고 사항[[notes]]
100+
101+
- BERT는 절대 위치 임베딩을 사용하므로, 오른쪽에 입력이 패딩돼야 합니다.
102+
- 임베딩 크기 `E`는 히든 크기 `H`와 다릅니다. 임베딩은 문맥에 독립적(각 토큰마다 하나의 임베딩 벡터)이고, 은닉 상태는 문맥에 의존적(토큰 시퀀스마다 하나의 은닉 상태)입니다. 임베딩 행렬은 `V x E`(V: 어휘 크기)이므로, 일반적으로 `H >> E`가 더 논리적입니다. `E < H`일 때 모델 파라미터가 더 적어집니다.
103+
104+
## 참고 자료[[resources]]
105+
106+
아래 섹션의 자료들은 공식 Hugging Face 및 커뮤니티(🌎 표시) 자료로, AlBERT를 시작하는 데 도움이 됩니다. 여기에 추가할 자료가 있다면 Pull Request를 보내주세요! 기존 자료와 중복되지 않고 새로운 내용을 담고 있으면 좋습니다.
107+
108+
<PipelineTag pipeline="text-classification"/>
109+
110+
- [`AlbertForSequenceClassification`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification)에서 지원됩니다.
111+
112+
- [`TFAlbertForSequenceClassification`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification)에서 지원됩니다.
113+
114+
- [`FlaxAlbertForSequenceClassification`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/flax/text-classification)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_flax.ipynb)에서 지원됩니다.
115+
- [텍스트 분류 작업 가이드](../tasks/sequence_classification)에서 모델 사용법을 확인하세요.
116+
117+
<PipelineTag pipeline="token-classification"/>
118+
119+
- [`AlbertForTokenClassification`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification)에서 지원됩니다.
120+
121+
- [`TFAlbertForTokenClassification`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/token-classification)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb)에서 지원됩니다.
122+
123+
- [`FlaxAlbertForTokenClassification`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification)에서 지원됩니다.
124+
- 🤗 Hugging Face의 [토큰 분류](https://huggingface.co/course/chapter7/2?fw=pt) 강좌
125+
- [토큰 분류 작업 가이드](../tasks/token_classification)에서 모델 사용법을 확인하세요.
126+
127+
<PipelineTag pipeline="fill-mask"/>
128+
129+
- [`AlbertForMaskedLM`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#robertabertdistilbert-and-masked-language-modeling)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)에서 지원됩니다.
130+
- [`TFAlbertForMaskedLM`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_mlmpy)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)에서 지원됩니다.
131+
- [`FlaxAlbertForMaskedLM`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#masked-language-modeling)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/masked_language_modeling_flax.ipynb)에서 지원됩니다.
132+
- 🤗 Hugging Face의 [마스킹 언어 모델링](https://huggingface.co/course/chapter7/3?fw=pt) 강좌
133+
- [마스킹 언어 모델링 작업 가이드](../tasks/masked_language_modeling)에서 모델 사용법을 확인하세요.
134+
135+
<PipelineTag pipeline="question-answering"/>
136+
137+
- [`AlbertForQuestionAnswering`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb)에서 지원됩니다.
138+
- [`TFAlbertForQuestionAnswering`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/question-answering)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb)에서 지원됩니다.
139+
- [`FlaxAlbertForQuestionAnswering`]은 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering)에서 지원됩니다.
140+
- [질의응답](https://huggingface.co/course/chapter7/7?fw=pt) 🤗 Hugging Face 강좌의 챕터.
141+
- [질의응답 작업 가이드](../tasks/question_answering)에서 모델 사용법을 확인하세요.
142+
143+
**다중 선택(Multiple choice)**
144+
145+
- [`AlbertForMultipleChoice`]는 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/multiple-choice)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb)에서 지원됩니다.
146+
- [`TFAlbertForMultipleChoice`]는 이 [예제 스크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/multiple-choice)[노트북](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb)에서 지원됩니다.
147+
148+
- [다중 선택 작업 가이드](../tasks/multiple_choice)에서 모델 사용법을 확인하세요.
149+
150+
## AlbertConfig[[albertconfig]]
151+
152+
[[autodoc]] AlbertConfig
153+
154+
## AlbertTokenizer[[alberttokenizer]]
155+
156+
[[autodoc]] AlbertTokenizer - build_inputs_with_special_tokens - get_special_tokens_mask - create_token_type_ids_from_sequences - save_vocabulary
157+
158+
## AlbertTokenizerFast[[alberttokenizerfast]]
159+
160+
[[autodoc]] AlbertTokenizerFast
161+
162+
## Albert 특화 출력[[albert-specific-outputs]]
163+
164+
[[autodoc]] models.albert.modeling_albert.AlbertForPreTrainingOutput
165+
166+
[[autodoc]] models.albert.modeling_tf_albert.TFAlbertForPreTrainingOutput
167+
168+
<frameworkcontent>
169+
<pt>
170+
171+
## AlbertModel[[albertmodel]]
172+
173+
[[autodoc]] AlbertModel - forward
174+
175+
## AlbertForPreTraining[[albertforpretraining]]
176+
177+
[[autodoc]] AlbertForPreTraining - forward
178+
179+
## AlbertForMaskedLM[[albertformaskedlm]]
180+
181+
[[autodoc]] AlbertForMaskedLM - forward
182+
183+
## AlbertForSequenceClassification[[albertforsequenceclassification]]
184+
185+
[[autodoc]] AlbertForSequenceClassification - forward
186+
187+
## AlbertForMultipleChoice[[albertformultiplechoice]]
188+
189+
[[autodoc]] AlbertForMultipleChoice
190+
191+
## AlbertForTokenClassification[[albertfortokenclassification]]
192+
193+
[[autodoc]] AlbertForTokenClassification - forward
194+
195+
## AlbertForQuestionAnswering[[albertforquestionanswering]]
196+
197+
[[autodoc]] AlbertForQuestionAnswering - forward
198+
199+
</pt>
200+
201+
<tf>
202+
203+
## TFAlbertModel[[tfalbertmodel]]
204+
205+
[[autodoc]] TFAlbertModel - call
206+
207+
## TFAlbertForPreTraining[[tfalbertforpretraining]]
208+
209+
[[autodoc]] TFAlbertForPreTraining - call
210+
211+
## TFAlbertForMaskedLM[[tfalbertformaskedlm]]
212+
213+
[[autodoc]] TFAlbertForMaskedLM - call
214+
215+
## TFAlbertForSequenceClassification[[tfalbertforsequenceclassification]]
216+
217+
[[autodoc]] TFAlbertForSequenceClassification - call
218+
219+
## TFAlbertForMultipleChoice[[tfalbertformultiplechoice]]
220+
221+
[[autodoc]] TFAlbertForMultipleChoice - call
222+
223+
## TFAlbertForTokenClassification[[tfalbertfortokenclassification]]
224+
225+
[[autodoc]] TFAlbertForTokenClassification - call
226+
227+
## TFAlbertForQuestionAnswering[[tfalbertforquestionanswering]]
228+
229+
[[autodoc]] TFAlbertForQuestionAnswering - call
230+
231+
</tf>
232+
<jax>
233+
234+
## FlaxAlbertModel[[flaxalbertmodel]]
235+
236+
[[autodoc]] FlaxAlbertModel - **call**
237+
238+
## FlaxAlbertForPreTraining[[flaxalbertforpretraining]]
239+
240+
[[autodoc]] FlaxAlbertForPreTraining - **call**
241+
242+
## FlaxAlbertForMaskedLM[[flaxalbertformaskedlm]]
243+
244+
[[autodoc]] FlaxAlbertForMaskedLM - **call**
245+
246+
## FlaxAlbertForSequenceClassification[[flaxalbertforsequenceclassification]]
247+
248+
[[autodoc]] FlaxAlbertForSequenceClassification - **call**
249+
250+
## FlaxAlbertForMultipleChoice[[flaxalbertformultiplechoice]]
251+
252+
[[autodoc]] FlaxAlbertForMultipleChoice - **call**
253+
254+
## FlaxAlbertForTokenClassification[[flaxalbertfortokenclassification]]
255+
256+
[[autodoc]] FlaxAlbertForTokenClassification - **call**
257+
258+
## FlaxAlbertForQuestionAnswering[[flaxalbertforquestionanswering]]
259+
260+
[[autodoc]] FlaxAlbertForQuestionAnswering - **call**
261+
262+
</jax>
263+
</frameworkcontent>

0 commit comments

Comments
 (0)