้กน็›ฎๆ–‡ไปถๅคน

ๆ–‡ไปถ
wehub-resource-sync e06fe8e8c6
Secret Leaks / trufflehog (push) Failing after 1s
Build documentation / build (push) Failing after 1s
Build documentation / build_other_lang (push) Failing after 0s
CodeQL Security Analysis / CodeQL Analysis (push) Failing after 0s
PR CI / pr-ci (push) Failing after 1s
Slow tests on important models (on Push - A10) / Get all modified files (push) Failing after 1s
Slow tests on important models (on Push - A10) / Model CI (push) Has been skipped
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:57:37 +08:00

318 ่กŒ
25 KiB
Markdown

ๆญคๆ–‡ไปถๅซๆœ‰ๆจกๆฃฑไธคๅฏ็š„ Unicode ๅญ—็ฌฆ
ๆญคๆ–‡ไปถๅซๆœ‰ๅฏ่ƒฝไผšไธŽๅ…ถไป–ๅญ—็ฌฆๆททๆท†็š„ Unicode ๅญ—็ฌฆใ€‚ ๅฆ‚ๆžœๆ‚จๆ˜ฏๆƒณ็‰นๆ„่ฟ™ๆ ท็š„๏ผŒๅฏไปฅๅฎ‰ๅ…จๅœฐๅฟฝ็•ฅ่ฏฅ่ญฆๅ‘Šใ€‚ ไฝฟ็”จ Escape ๆŒ‰้’ฎๆ˜พ็คบไป–ไปฌใ€‚
<!---
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.
-->
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/transformers-logo-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/transformers-logo-light.svg">
<img alt="Hugging Face Transformers Library" src="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/transformers-logo-light.svg" width="352" height="59" style="max-width: 100%;">
</picture>
<br/>
<br/>
</p>
<p align="center">
<a href="https://circleci.com/gh/huggingface/transformers"><img alt="Build" src="https://img.shields.io/circleci/build/github/huggingface/transformers/main"></a>
<a href="https://github.com/huggingface/transformers/blob/main/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/huggingface/transformers.svg?color=blue"></a>
<a href="https://huggingface.co/docs/transformers/index"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/transformers/index.svg?down_color=red&down_message=offline&up_message=online"></a>
<a href="https://github.com/huggingface/transformers/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/transformers.svg"></a>
<a href="https://github.com/huggingface/transformers/blob/main/CODE_OF_CONDUCT.md"><img alt="Contributor Covenant" src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg"></a>
<a href="https://zenodo.org/badge/latestdoi/155220641"><img src="https://zenodo.org/badge/155220641.svg" alt="DOI"></a>
</p>
<h4 align="center">
<p>
<a href="https://github.com/huggingface/transformers/">English</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_zh-hans.md">็ฎ€ไฝ“ไธญๆ–‡</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_zh-hant.md">็น้ซ”ไธญๆ–‡</a> |
<b>ํ•œ๊ตญ์–ด</b> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_es.md">Espaรฑol</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_ja.md">ๆ—ฅๆœฌ่ชž</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_hd.md">เคนเคฟเคจเฅเคฆเฅ€</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_ru.md">ะ ัƒััะบะธะน</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_pt-br.md">ะ ortuguรชs</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_te.md">เฐคเฑ†เฐฒเฑเฐ—เฑ</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_fr.md">Franรงais</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_de.md">Deutsch</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_it.md">Italiano</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_vi.md">Tiแบฟng Viแป‡t</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_ar.md">ุงู„ุนุฑุจูŠุฉ</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_ur.md">ุงุฑุฏูˆ</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_bn.md">เฆฌเฆพเฆ‚เฆฒเฆพ</a> |
<a href="https://github.com/huggingface/transformers/blob/main/i18n/README_tr.md">Tรผrkรงe</a> |
</p>
</h4>
<h3 align="center">
<p> Jax, Pytorch, TensorFlow๋ฅผ ์œ„ํ•œ ์ตœ์ฒจ๋‹จ ๋จธ์‹ ๋Ÿฌ๋‹</p>
</h3>
<h3 align="center">
<a href="https://hf.co/course"><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/course_banner.png"></a>
</h3>
๐Ÿค— Transformers๋Š” ํ…์ŠคํŠธ, ๋น„์ „, ์˜ค๋””์˜ค์™€ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ๋ถ„์•ผ์—์„œ ์—ฌ๋Ÿฌ ๊ณผ์ œ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ์ˆ˜์ฒœ ๊ฐœ์˜ ์‚ฌ์ „ ํ•™์Šต๋œ ๋ชจ๋ธ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
์ œ๊ณต๋˜๋Š” ๋ชจ๋ธ์„ ํ†ตํ•ด ๋‹ค์Œ ๊ณผ์ œ๋ฅผ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ๐Ÿ“ ํ…์ŠคํŠธ: 100๊ฐœ ์ด์ƒ์˜ ์–ธ์–ด๋“ค๋กœ, ํ…์ŠคํŠธ ๋ถ„๋ฅ˜, ์ •๋ณด ์ถ”์ถœ, ์งˆ๋ฌธ ๋‹ต๋ณ€, ์š”์•ฝ, ๋ฒˆ์—ญ ๋ฐ ๋ฌธ์žฅ ์ƒ์„ฑ
- ๐Ÿ–ผ๏ธ ์ด๋ฏธ์ง€: ์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜(Image Classification), ๊ฐ์ฒด ํƒ์ง€(Object Detection) ๋ฐ ๋ถ„ํ• (Segmentation)
- ๐Ÿ—ฃ๏ธ ์˜ค๋””์˜ค: ์Œ์„ฑ ์ธ์‹(Speech Recognition) ๋ฐ ์˜ค๋””์˜ค ๋ถ„๋ฅ˜(Audio Classification)
Transformer์˜ ๋ชจ๋ธ์€ ํ‘œ๋ฅผ ํ†ตํ•œ ์งˆ์˜์‘๋‹ต(Table QA), ๊ด‘ํ•™ ๋ฌธ์ž ์ธ์‹(Optical Character Recognition), ์Šค์บ” ํ•œ ๋ฌธ์„œ์—์„œ ์ •๋ณด ์ถ”์ถœ, ๋น„๋””์˜ค ๋ถ„๋ฅ˜ ๋ฐ ์‹œ๊ฐ์  ์งˆ์˜์‘๋‹ต๊ณผ ๊ฐ™์€ **์—ฌ๋Ÿฌ ๋ถ„์•ผ๊ฐ€ ๊ฒฐํ•ฉ๋œ** ๊ณผ์ œ ๋˜ํ•œ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๐Ÿค— Transformers๋Š” ์ด๋Ÿฌํ•œ ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์„ ๋น ๋ฅด๊ฒŒ ๋‹ค์šด๋กœ๋“œํ•ด ํŠน์ • ํ…์ŠคํŠธ์— ์‚ฌ์šฉํ•˜๊ณ , ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋กœ fine-tuningํ•ด ์ปค๋ฎค๋‹ˆํ‹ฐ๋‚˜ ์šฐ๋ฆฌ์˜ [๋ชจ๋ธ ํ—ˆ๋ธŒ](https://huggingface.co/models)์— ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋„๋ก API๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, ๋ชจ๋ธ ๊ตฌ์กฐ๋ฅผ ์ •์˜ํ•˜๋Š” ๊ฐ ํŒŒ์ด์ฌ ๋ชจ๋“ˆ์€ ์™„์ „ํžˆ ๋…๋ฆฝ์ ์ด์—ฌ์„œ ์—ฐ๊ตฌ ์‹คํ—˜์„ ์œ„ํ•ด ์†์‰ฝ๊ฒŒ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๐Ÿค— Transformers๋Š” ๊ฐ€์žฅ ์œ ๋ช…ํ•œ 3๊ฐœ์˜ ๋”ฅ๋Ÿฌ๋‹ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์ด๋“ค์€ ์„œ๋กœ ์™„๋ฒฝํžˆ ์—ฐ๋™๋ฉ๋‹ˆ๋‹ค โ€” [Jax](https://jax.readthedocs.io/en/latest/), [PyTorch](https://pytorch.org/), [TensorFlow](https://www.tensorflow.org/). ๊ฐ„๋‹จํ•˜๊ฒŒ ์ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ค‘ ํ•˜๋‚˜๋กœ ๋ชจ๋ธ์„ ํ•™์Šตํ•˜๊ณ , ๋˜ ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ ์ถ”๋ก ์„ ์œ„ํ•ด ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## ์˜จ๋ผ์ธ ๋ฐ๋ชจ
๋Œ€๋ถ€๋ถ„์˜ ๋ชจ๋ธ์„ [๋ชจ๋ธ ํ—ˆ๋ธŒ](https://huggingface.co/models) ํŽ˜์ด์ง€์—์„œ ๋ฐ”๋กœ ํ…Œ์ŠคํŠธํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ณต๊ฐœ ๋ฐ ๋น„๊ณต๊ฐœ ๋ชจ๋ธ์„ ์œ„ํ•œ [๋น„๊ณต๊ฐœ ๋ชจ๋ธ ํ˜ธ์ŠคํŒ…, ๋ฒ„์ „ ๊ด€๋ฆฌ, ์ถ”๋ก  API](https://huggingface.co/pricing)๋„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
์•„๋ž˜ ๋ช‡ ๊ฐ€์ง€ ์˜ˆ์‹œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค:
์ž์—ฐ์–ด ์ฒ˜๋ฆฌ:
- [BERT๋กœ ๋งˆ์Šคํ‚น๋œ ๋‹จ์–ด ์™„์„ฑํ•˜๊ธฐ](https://huggingface.co/google-bert/bert-base-uncased?text=Paris+is+the+%5BMASK%5D+of+France)
- [Electra๋ฅผ ์ด์šฉํ•œ ๊ฐœ์ฒด๋ช… ์ธ์‹](https://huggingface.co/dbmdz/electra-large-discriminator-finetuned-conll03-english?text=My+name+is+Sarah+and+I+live+in+London+city)
- [GPT-2๋กœ ํ…์ŠคํŠธ ์ƒ์„ฑํ•˜๊ธฐ](https://huggingface.co/openai-community/gpt2?text=A+long+time+ago%2C+)
- [RoBERTa๋กœ ์ž์—ฐ์–ด ์ถ”๋ก ํ•˜๊ธฐ](https://huggingface.co/FacebookAI/roberta-large-mnli?text=The+dog+was+lost.+Nobody+lost+any+animal)
- [BART๋ฅผ ์ด์šฉํ•œ ์š”์•ฝ](https://huggingface.co/facebook/bart-large-cnn?text=The+tower+is+324+metres+%281%2C063+ft%29+tall%2C+about+the+same+height+as+an+81-storey+building%2C+and+the+tallest+structure+in+Paris.+Its+base+is+square%2C+measuring+125+metres+%28410+ft%29+on+each+side.+During+its+construction%2C+the+Eiffel+Tower+surpassed+the+Washington+Monument+to+become+the+tallest+man-made+structure+in+the+world%2C+a+title+it+held+for+41+years+until+the+Chrysler+Building+in+New+York+City+was+finished+in+1930.+It+was+the+first+structure+to+reach+a+height+of+300+metres.+Due+to+the+addition+of+a+broadcasting+aerial+at+the+top+of+the+tower+in+1957%2C+it+is+now+taller+than+the+Chrysler+Building+by+5.2+metres+%2817+ft%29.+Excluding+transmitters%2C+the+Eiffel+Tower+is+the+second+tallest+free-standing+structure+in+France+after+the+Millau+Viaduct)
- [DistilBERT๋ฅผ ์ด์šฉํ•œ ์งˆ๋ฌธ ๋‹ต๋ณ€](https://huggingface.co/distilbert/distilbert-base-uncased-distilled-squad?text=Which+name+is+also+used+to+describe+the+Amazon+rainforest+in+English%3F&context=The+Amazon+rainforest+%28Portuguese%3A+Floresta+Amaz%C3%B4nica+or+Amaz%C3%B4nia%3B+Spanish%3A+Selva+Amaz%C3%B3nica%2C+Amazon%C3%ADa+or+usually+Amazonia%3B+French%3A+For%C3%AAt+amazonienne%3B+Dutch%3A+Amazoneregenwoud%29%2C+also+known+in+English+as+Amazonia+or+the+Amazon+Jungle%2C+is+a+moist+broadleaf+forest+that+covers+most+of+the+Amazon+basin+of+South+America.+This+basin+encompasses+7%2C000%2C000+square+kilometres+%282%2C700%2C000+sq+mi%29%2C+of+which+5%2C500%2C000+square+kilometres+%282%2C100%2C000+sq+mi%29+are+covered+by+the+rainforest.+This+region+includes+territory+belonging+to+nine+nations.+The+majority+of+the+forest+is+contained+within+Brazil%2C+with+60%25+of+the+rainforest%2C+followed+by+Peru+with+13%25%2C+Colombia+with+10%25%2C+and+with+minor+amounts+in+Venezuela%2C+Ecuador%2C+Bolivia%2C+Guyana%2C+Suriname+and+French+Guiana.+States+or+departments+in+four+nations+contain+%22Amazonas%22+in+their+names.+The+Amazon+represents+over+half+of+the+planet%27s+remaining+rainforests%2C+and+comprises+the+largest+and+most+biodiverse+tract+of+tropical+rainforest+in+the+world%2C+with+an+estimated+390+billion+individual+trees+divided+into+16%2C000+species)
- [T5๋กœ ๋ฒˆ์—ญํ•˜๊ธฐ](https://huggingface.co/google-t5/t5-base?text=My+name+is+Wolfgang+and+I+live+in+Berlin)
์ปดํ“จํ„ฐ ๋น„์ „:
- [ViT์™€ ํ•จ๊ป˜ํ•˜๋Š” ์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜](https://huggingface.co/google/vit-base-patch16-224)
- [DETR๋กœ ๊ฐ์ฒด ํƒ์ง€ํ•˜๊ธฐ](https://huggingface.co/facebook/detr-resnet-50)
- [SegFormer๋กœ ์˜๋ฏธ์  ๋ถ„ํ• (semantic segmentation)ํ•˜๊ธฐ](https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512)
- [Mask2Former๋กœ ํŒ์˜ตํ‹ฑ ๋ถ„ํ• (panoptic segmentation)ํ•˜๊ธฐ](https://huggingface.co/facebook/mask2former-swin-large-coco-panoptic)
- [Depth Anything์œผ๋กœ ๊นŠ์ด ์ถ”์ •(depth estimation)ํ•˜๊ธฐ](https://huggingface.co/docs/transformers/main/model_doc/depth_anything)
- [VideoMAE์™€ ํ•จ๊ป˜ํ•˜๋Š” ๋น„๋””์˜ค ๋ถ„๋ฅ˜](https://huggingface.co/docs/transformers/model_doc/videomae)
- [OneFormer๋กœ ์œ ๋‹ˆ๋ฒ„์„ค ๋ถ„ํ• (universal segmentation)ํ•˜๊ธฐ](https://huggingface.co/shi-labs/oneformer_ade20k_dinat_large)
์˜ค๋””์˜ค:
- [Whisper์™€ ํ•จ๊ป˜ํ•˜๋Š” ์ž๋™ ์Œ์„ฑ ์ธ์‹](https://huggingface.co/openai/whisper-large-v3)
- [Wav2Vec2๋กœ ํ‚ค์›Œ๋“œ ๊ฒ€์ถœ(keyword spotting)ํ•˜๊ธฐ](https://huggingface.co/superb/wav2vec2-base-superb-ks)
- [Audio Spectrogram Transformer๋กœ ์˜ค๋””์˜ค ๋ถ„๋ฅ˜ํ•˜๊ธฐ](https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593)
๋ฉ€ํ‹ฐ ๋ชจ๋‹ฌ(Multimodal Task):
- [TAPAS๋กœ ํ‘œ ์•ˆ์—์„œ ์งˆ๋ฌธ ๋‹ต๋ณ€ํ•˜๊ธฐ](https://huggingface.co/google/tapas-base-finetuned-wtq)
- [ViLT์™€ ํ•จ๊ป˜ํ•˜๋Š” ์‹œ๊ฐ์  ์งˆ์˜์‘๋‹ต](https://huggingface.co/dandelin/vilt-b32-finetuned-vqa)
- [LLaVa๋กœ ์ด๋ฏธ์ง€์— ์„ค๋ช… ๋„ฃ๊ธฐ](https://huggingface.co/llava-hf/llava-1.5-7b-hf)
- [SigLIP์™€ ํ•จ๊ป˜ํ•˜๋Š” ์ œ๋กœ ์ƒท(zero-shot) ์ด๋ฏธ์ง€ ๋ถ„๋ฅ˜](https://huggingface.co/google/siglip-so400m-patch14-384)
- [LayoutLM์œผ๋กœ ๋ฌธ์„œ ์•ˆ์—์„œ ์งˆ๋ฌธ ๋‹ต๋ณ€ํ•˜๊ธฐ](https://huggingface.co/impira/layoutlm-document-qa)
- [X-CLIP๊ณผ ํ•จ๊ป˜ํ•˜๋Š” ์ œ๋กœ ์ƒท(zero-shot) ๋น„๋””์˜ค ๋ถ„๋ฅ˜](https://huggingface.co/docs/transformers/model_doc/xclip)
- [OWLv2๋กœ ์ง„ํ–‰ํ•˜๋Š” ์ œ๋กœ ์ƒท(zero-shot) ๊ฐ์ฒด ํƒ์ง€](https://huggingface.co/docs/transformers/en/model_doc/owlv2)
- [CLIPSeg๋กœ ์ง„ํ–‰ํ•˜๋Š” ์ œ๋กœ ์ƒท(zero-shot) ์ด๋ฏธ์ง€ ๋ถ„ํ• ](https://huggingface.co/docs/transformers/model_doc/clipseg)
- [SAM๊ณผ ํ•จ๊ป˜ํ•˜๋Š” ์ž๋™ ๋งˆ์Šคํฌ ์ƒ์„ฑ](https://huggingface.co/docs/transformers/model_doc/sam)
**[Transformer์™€ ๊ธ€์“ฐ๊ธฐ](https://transformer.huggingface.co)** ๋Š” ์ด ์ €์žฅ์†Œ์˜ ํ…์ŠคํŠธ ์ƒ์„ฑ ๋Šฅ๋ ฅ์— ๊ด€ํ•œ Hugging Face ํŒ€์˜ ๊ณต์‹ ๋ฐ๋ชจ์ž…๋‹ˆ๋‹ค.
## Transformers๋ฅผ ์‚ฌ์šฉํ•œ 100๊ฐœ์˜ ํ”„๋กœ์ ํŠธ
Transformers๋Š” ์‚ฌ์ „ ํ•™์Šต๋œ ๋ชจ๋ธ๋“ค์„ ์ด์šฉํ•˜๋Š” ๋„๊ตฌ๋ฅผ ๋„˜์–ด Transformers์™€ ํ•จ๊ป˜ ๋นŒ๋“œ ๋œ ํ”„๋กœ์ ํŠธ ๋ฐ Hugging Face Hub๋ฅผ ์œ„ํ•œ ํ•˜๋‚˜์˜ ์ปค๋ฎค๋‹ˆํ‹ฐ์ž…๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” Transformers๋ฅผ ํ†ตํ•ด ๊ฐœ๋ฐœ์ž, ์—ฐ๊ตฌ์ž, ํ•™์ƒ, ๊ต์ˆ˜, ์—”์ง€๋‹ˆ์–ด ๋ฐ ๋ชจ๋“  ์ด๋“ค์ด ๊ฟˆ์„ ํ’ˆ์€ ํ”„๋กœ์ ํŠธ(Dream Project)๋ฅผ ๋นŒ๋“œ ํ•  ์ˆ˜ ์žˆ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค.
Transformers์— ๋‹ฌ๋ฆฐ 100,000๊ฐœ์˜ ๋ณ„์„ ์ถ•ํ•˜ํ•˜๊ธฐ ์œ„ํ•ด, ์šฐ๋ฆฌ๋Š” ์ปค๋ฎค๋‹ˆํ‹ฐ๋ฅผ ์ฃผ๋ชฉํ•˜๊ณ ์ž Transformers๋ฅผ ํ’ˆ๊ณ  ๋นŒ๋“œ ๋œ 100๊ฐœ์˜ ์–ด๋งˆ์–ด๋งˆํ•œ ํ”„๋กœ์ ํŠธ๋“ค์„ ์„ ๋ณ„ํ•˜์—ฌ [awesome-transformers](https://github.com/huggingface/transformers/blob/main/awesome-transformers.md) ํŽ˜์ด์ง€์— ๋‚˜์—ดํ•˜์˜€์Šต๋‹ˆ๋‹ค.
๋งŒ์ผ ์†Œ์œ ํ•œ ํ˜น์€ ์‚ฌ์šฉํ•˜๊ณ  ๊ณ„์‹  ํ”„๋กœ์ ํŠธ๊ฐ€ ์ด ๋ฆฌ์ŠคํŠธ์— ๊ผญ ๋“ฑ์žฌ๋˜์–ด์•ผ ํ•œ๋‹ค๊ณ  ๋ฏฟ์œผ์‹ ๋‹ค๋ฉด, PR์„ ์—ด๊ณ  ์ถ”๊ฐ€ํ•˜์—ฌ ์ฃผ์„ธ์š”!
## ์กฐ์ง ์•ˆ์—์„œ AI ์‚ฌ์šฉ์— ๋Œ€ํ•ด ์ง„์ง€ํ•˜๊ฒŒ ๊ณ ๋ฏผ ์ค‘์ด์‹ ๊ฐ€์š”? Hugging Face Enterprise Hub์„ ํ†ตํ•ด ๋” ๋นจ๋ฆฌ ๊ตฌ์ถ•ํ•ด ๋ณด์„ธ์š”.
<a target="_blank" href="https://huggingface.co/enterprise">
<img alt="Hugging Face Enterprise Hub" src="https://github.com/user-attachments/assets/247fb16d-d251-4583-96c4-d3d76dda4925">
</a><br>
## ํ€ต ํˆฌ์–ด
์ฃผ์–ด์ง„ ์ž…๋ ฅ(ํ…์ŠคํŠธ, ์ด๋ฏธ์ง€, ์˜ค๋””์˜ค, ...)์— ๋ฐ”๋กœ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก, ์šฐ๋ฆฌ๋Š” `pipeline` API๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. Pipeline์€ ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ๊ณผ ๊ทธ ๋ชจ๋ธ์„ ํ•™์Šตํ•  ๋•Œ ์ ์šฉํ•œ ์ „์ฒ˜๋ฆฌ ๋ฐฉ์‹์„ ํ•˜๋‚˜๋กœ ํ•ฉ์นฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ๊ธ์ •์ ์ธ ํ…์ŠคํŠธ์™€ ๋ถ€์ •์ ์ธ ํ…์ŠคํŠธ๋ฅผ ๋ถ„๋ฅ˜ํ•˜๊ธฐ ์œ„ํ•ด pipeline์„ ์‚ฌ์šฉํ•œ ๊ฐ„๋‹จํ•œ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค:
```python
>>> from transformers import pipeline
# ๊ฐ์ • ๋ถ„์„ ํŒŒ์ดํ”„๋ผ์ธ์„ ํ• ๋‹นํ•˜์„ธ์š”
>>> classifier = pipeline('sentiment-analysis')
>>> classifier('We are very happy to introduce pipeline to the transformers repository.')
[{'label': 'POSITIVE', 'score': 0.9996980428695679}]
```
์ฝ”๋“œ์˜ ๋‘ ๋ฒˆ์งธ ์ค„์€ pipeline์ด ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์บ์‹œ๋กœ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ์„ธ ๋ฒˆ์งธ ์ค„์—์„  ๊ทธ ๋ชจ๋ธ์ด ์ฃผ์–ด์ง„ ํ…์ŠคํŠธ๋ฅผ ํ‰๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ๋ชจ๋ธ์€ 99.97%์˜ ํ™•๋ฅ ๋กœ ํ…์ŠคํŠธ๊ฐ€ ๊ธ์ •์ ์ด๋ผ๊ณ  ํ‰๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
์ž์—ฐ์–ด ์ฒ˜๋ฆฌ(NLP) ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์ปดํ“จํ„ฐ ๋น„์ „, ๋ฐœํ™”(Speech) ๊ณผ์ œ๋“ค์„ ์‚ฌ์ „ ํ•™์Šต๋œ `pipeline`์œผ๋กœ ๋ฐ”๋กœ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์‚ฌ์ง„์—์„œ ์†์‰ฝ๊ฒŒ ๊ฐ์ฒด๋“ค์„ ํƒ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.:
``` python
>>> import requests
>>> from PIL import Image
>>> from transformers import pipeline
# ๊ท€์—ฌ์šด ๊ณ ์–‘์ด๊ฐ€ ์žˆ๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜์„ธ์š”
>>> url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/coco_sample.png"
>>> image_data = requests.get(url, stream=True).raw
>>> image = Image.open(image_data)
# ๊ฐ์ฒด ๊ฐ์ง€๋ฅผ ์œ„ํ•œ ํŒŒ์ดํ”„๋ผ์ธ์„ ํ• ๋‹นํ•˜์„ธ์š”
>>> object_detector = pipeline('object-detection')
>>> object_detector(image)
[{'score': 0.9982201457023621,
'label': 'remote',
'box': {'xmin': 40, 'ymin': 70, 'xmax': 175, 'ymax': 117}},
{'score': 0.9960021376609802,
'label': 'remote',
'box': {'xmin': 333, 'ymin': 72, 'xmax': 368, 'ymax': 187}},
{'score': 0.9954745173454285,
'label': 'couch',
'box': {'xmin': 0, 'ymin': 1, 'xmax': 639, 'ymax': 473}},
{'score': 0.9988006353378296,
'label': 'cat',
'box': {'xmin': 13, 'ymin': 52, 'xmax': 314, 'ymax': 470}},
{'score': 0.9986783862113953,
'label': 'cat',
'box': {'xmin': 345, 'ymin': 23, 'xmax': 640, 'ymax': 368}}]
```
์œ„์™€ ๊ฐ™์ด, ์šฐ๋ฆฌ๋Š” ์ด๋ฏธ์ง€์—์„œ ํƒ์ง€๋œ ๊ฐ์ฒด๋“ค์— ๋Œ€ํ•˜์—ฌ ๊ฐ์ฒด๋ฅผ ๊ฐ์‹ธ๋Š” ๋ฐ•์Šค์™€ ํ™•๋ฅ  ๋ฆฌ์ŠคํŠธ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์™ผ์ชฝ์ด ์›๋ณธ ์ด๋ฏธ์ง€์ด๋ฉฐ ์˜ค๋ฅธ์ชฝ์€ ํ•ด๋‹น ์ด๋ฏธ์ง€์— ํƒ์ง€๋œ ๊ฒฐ๊ณผ๋ฅผ ํ‘œ์‹œํ•˜์˜€์Šต๋‹ˆ๋‹ค.
<h3 align="center">
<a><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/coco_sample.png" width="400"></a>
<a><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/coco_sample_post_processed.png" width="400"></a>
</h3>
[์ด ํŠœํ† ๋ฆฌ์–ผ](https://huggingface.co/docs/transformers/ko/task_summary)์—์„œ `pipeline` API๊ฐ€ ์ง€์›ํ•˜๋Š” ๋‹ค์–‘ํ•œ ๊ณผ์ œ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ฝ”๋“œ 3์ค„๋กœ ์›ํ•˜๋Š” ๊ณผ์ œ์— ๋งž๊ฒŒ ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์„ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ณ  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ PyTorch ๋ฒ„์ „์ž…๋‹ˆ๋‹ค:
```python
>>> from transformers import AutoTokenizer, AutoModel
>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
>>> model = AutoModel.from_pretrained("google-bert/bert-base-uncased")
>>> inputs = tokenizer("Hello world!", return_tensors="pt")
>>> outputs = model(**inputs)
```
๋‹ค์Œ์€ TensorFlow ๋ฒ„์ „์ž…๋‹ˆ๋‹ค:
```python
>>> from transformers import AutoTokenizer, TFAutoModel
>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
>>> model = TFAutoModel.from_pretrained("google-bert/bert-base-uncased")
>>> inputs = tokenizer("Hello world!", return_tensors="tf")
>>> outputs = model(**inputs)
```
ํ† ํฌ๋‚˜์ด์ €๋Š” ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์˜ ๋ชจ๋“  ์ „์ฒ˜๋ฆฌ๋ฅผ ์ฑ…์ž„์ง‘๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  (์œ„์˜ ์˜ˆ์‹œ์ฒ˜๋Ÿผ) 1๊ฐœ์˜ ์ŠคํŠธ๋ง์ด๋‚˜ ๋ฆฌ์ŠคํŠธ๋„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ† ํฌ๋‚˜์ด์ €๋Š” ๋”•์…”๋„ˆ๋ฆฌ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š”๋ฐ, ์ด๋Š” ๋‹ค์šด์ŠคํŠธ๋ฆผ ์ฝ”๋“œ์— ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ์–ธํŒจํ‚น ์—ฐ์‚ฐ์ž ** ๋ฅผ ์ด์šฉํ•ด ๋ชจ๋ธ์— ๋ฐ”๋กœ ์ „๋‹ฌํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
๋ชจ๋ธ ์ž์ฒด๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” [Pytorch `nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)์ด๋‚˜ [TensorFlow `tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model)์ž…๋‹ˆ๋‹ค. [์ด ํŠœํ† ๋ฆฌ์–ผ](https://huggingface.co/docs/transformers/ko/training)์€ ์ด๋Ÿฌํ•œ ๋ชจ๋ธ์„ ํ‘œ์ค€์ ์ธ PyTorch๋‚˜ TensorFlow ํ•™์Šต ๊ณผ์ •์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•, ๋˜๋Š” ์ƒˆ๋กœ์šด ๋ฐ์ดํ„ฐ๋กœ ํŒŒ์ธ ํŠœ๋‹ํ•˜๊ธฐ ์œ„ํ•ด `Trainer` API๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ด ์ค๋‹ˆ๋‹ค.
## ์™œ transformers๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ• ๊นŒ์š”?
1. ์†์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ์ฒจ๋‹จ ๋ชจ๋ธ:
- ์ž์—ฐ์–ด ์ดํ•ด(NLU)์™€ ์ƒ์„ฑ(NLG), ์ปดํ“จํ„ฐ ๋น„์ „, ์˜ค๋””์˜ค ๊ณผ์ œ์—์„œ ๋›ฐ์–ด๋‚œ ์„ฑ๋Šฅ์„ ๋ณด์ž…๋‹ˆ๋‹ค.
- ๊ต์œก์ž์™€ ์‹ค๋ฌด์ž์—๊ฒŒ ์ง„์ž… ์žฅ๋ฒฝ์ด ๋‚ฎ์Šต๋‹ˆ๋‹ค.
- 3๊ฐœ์˜ ํด๋ž˜์Šค๋งŒ ๋ฐฐ์šฐ๋ฉด ๋ฐ”๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ํ•˜๋‚˜์˜ API๋กœ ๋ชจ๋“  ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
1. ๋” ์ ์€ ๊ณ„์‚ฐ ๋น„์šฉ, ๋” ์ ์€ ํƒ„์†Œ ๋ฐœ์ž๊ตญ:
- ์—ฐ๊ตฌ์ž๋“ค์€ ๋ชจ๋ธ์„ ๊ณ„์† ๋‹ค์‹œ ํ•™์Šต์‹œํ‚ค๋Š” ๋Œ€์‹  ํ•™์Šต๋œ ๋ชจ๋ธ์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ์‹ค๋ฌด์ž๋“ค์€ ํ•™์Šต์— ํ•„์š”ํ•œ ์‹œ๊ฐ„๊ณผ ๋น„์šฉ์„ ์ ˆ์•ฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ๋ชจ๋“  ๋ถ„์•ผ๋ฅผ ํ†ตํ‹€์–ด์„œ 400,000๊ฐœ ์ด์ƒ์˜ ์‚ฌ์ „ ํ•™์Šต๋œ ๋ชจ๋ธ์ด ์žˆ๋Š” ์ˆ˜์‹ญ ๊ฐœ์˜ ์•„ํ‚คํ…์ฒ˜.
1. ๋ชจ๋ธ์˜ ๊ฐ ์ƒ์• ์ฃผ๊ธฐ์— ์ ํ•ฉํ•œ ํ”„๋ ˆ์ž„์›Œํฌ:
- ์ฝ”๋“œ 3์ค„๋กœ ์ตœ์ฒจ๋‹จ ๋ชจ๋ธ์„ ํ•™์Šตํ•˜์„ธ์š”.
- ๋ชฉ์ ์— ์•Œ๋งž๊ฒŒ ๋ชจ๋ธ์„ TF2.0/Pytorch/Jax ํ”„๋ ˆ์ž„ ์›Œํฌ ์ค‘ ํ•˜๋‚˜๋กœ ์ด๋™์‹œํ‚ค์„ธ์š”.
- ํ•™์Šต, ํ‰๊ฐ€, ๊ณต๊ฐœ ๋“ฑ ๊ฐ ๋‹จ๊ณ„์— ๋งž๋Š” ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์›ํ•˜๋Š”๋Œ€๋กœ ์„ ํƒํ•˜์„ธ์š”.
1. ํ•„์š”ํ•œ ๋Œ€๋กœ ๋ชจ๋ธ์ด๋‚˜ ์˜ˆ์‹œ๋ฅผ ์ปค์Šคํ„ฐ๋งˆ์ด์ฆˆํ•˜์„ธ์š”:
- ์šฐ๋ฆฌ๋Š” ์ €์ž๊ฐ€ ๊ณต๊ฐœํ•œ ๊ฒฐ๊ณผ๋ฅผ ์žฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ ๋ชจ๋ธ ๊ตฌ์กฐ์˜ ์˜ˆ์‹œ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
- ๋ชจ๋ธ ๋‚ด๋ถ€ ๊ตฌ์กฐ๋Š” ๊ฐ€๋Šฅํ•œ ์ผ๊ด€์ ์œผ๋กœ ๊ณต๊ฐœ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
- ๋น ๋ฅธ ์‹คํ—˜์„ ์œ„ํ•ด ๋ชจ๋ธ ํŒŒ์ผ์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ๋…๋ฆฝ์ ์œผ๋กœ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## ์™œ transformers๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง์•„์•ผ ํ• ๊นŒ์š”?
- ์ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ์‹ ๊ฒฝ๋ง ๋ธ”๋ก์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ๋ชจ๋“ˆ์ด ์•„๋‹™๋‹ˆ๋‹ค. ์—ฐ๊ตฌ์ž๋“ค์ด ์—ฌ๋Ÿฌ ํŒŒ์ผ์„ ์‚ดํŽด๋ณด์ง€ ์•Š๊ณ  ๋ฐ”๋กœ ๊ฐ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก, ๋ชจ๋ธ ํŒŒ์ผ ์ฝ”๋“œ์˜ ์ถ”์ƒํ™” ์ˆ˜์ค€์„ ์ ์ •ํ•˜๊ฒŒ ์œ ์ง€ํ–ˆ์Šต๋‹ˆ๋‹ค.
- ํ•™์Šต API๋Š” ๋ชจ๋“  ๋ชจ๋ธ์— ์ ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“ค์–ด์ง€์ง„ ์•Š์•˜์ง€๋งŒ, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์ œ๊ณตํ•˜๋Š” ๋ชจ๋ธ๋“ค์— ์ ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์ตœ์ ํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์ธ ๋จธ์‹  ๋Ÿฌ๋‹์„ ์œ„ํ•ด์„ , ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”(์˜ˆ๋ฅผ ๋“ค๋ฉด, [Accelerate](https://huggingface.co/docs/accelerate/index)).
- ๊ฐ€๋Šฅํ•œ ๋งŽ์€ ์‚ฌ์šฉ ์˜ˆ์‹œ๋ฅผ ๋ณด์—ฌ๋“œ๋ฆฌ๊ณ  ์‹ถ์–ด์„œ, [์˜ˆ์‹œ ํด๋”](https://github.com/huggingface/transformers/tree/main/examples)์˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ค€๋น„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด ์Šคํฌ๋ฆฝํŠธ๋“ค์„ ์ˆ˜์ • ์—†์ด ํŠน์ •ํ•œ ๋ฌธ์ œ์— ๋ฐ”๋กœ ์ ์šฉํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•„์š”์— ๋งž๊ฒŒ ์ผ๋ถ€ ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•ด์•ผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## ์„ค์น˜
### pip๋กœ ์„ค์น˜ํ•˜๊ธฐ
์ด ์ €์žฅ์†Œ๋Š” Python 3.10+ ๋ฐ PyTorch 2.4+์—์„œ ํ…Œ์ŠคํŠธ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
[๊ฐ€์ƒ ํ™˜๊ฒฝ](https://docs.python.org/3/library/venv.html)์— ๐Ÿค— Transformers๋ฅผ ์„ค์น˜ํ•˜์„ธ์š”. Python ๊ฐ€์ƒ ํ™˜๊ฒฝ์— ์ต์ˆ™ํ•˜์ง€ ์•Š๋‹ค๋ฉด, [์‚ฌ์šฉ์ž ๊ฐ€์ด๋“œ](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)๋ฅผ ํ™•์ธํ•˜์„ธ์š”.
์šฐ์„ , ์‚ฌ์šฉํ•  Python ๋ฒ„์ „์œผ๋กœ ๊ฐ€์ƒ ํ™˜๊ฒฝ์„ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ•˜์„ธ์š”.
๊ทธ ๋‹ค์Œ, Flax, PyTorch, TensorFlow ์ค‘ ์ ์–ด๋„ ํ•˜๋‚˜๋Š” ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
ํ”Œ๋žซํผ์— ๋งž๋Š” ์„ค์น˜ ๋ช…๋ น์–ด๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด [TensorFlow ์„ค์น˜ ํŽ˜์ด์ง€](https://www.tensorflow.org/install/), [PyTorch ์„ค์น˜ ํŽ˜์ด์ง€](https://pytorch.org/get-started/locally/#start-locally), [Flax ์„ค์น˜ ํŽ˜์ด์ง€](https://github.com/google/flax#quick-install)๋ฅผ ํ™•์ธํ•˜์„ธ์š”.
์ด๋“ค ์ค‘ ์ ์–ด๋„ ํ•˜๋‚˜๊ฐ€ ์„ค์น˜๋˜์—ˆ๋‹ค๋ฉด, ๐Ÿค— Transformers๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด pip์„ ์ด์šฉํ•ด ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
```bash
pip install transformers
```
์˜ˆ์‹œ๋“ค์„ ์ฒดํ—˜ํ•ด๋ณด๊ณ  ์‹ถ๊ฑฐ๋‚˜, ์ตœ์ตœ์ตœ์ฒจ๋‹จ ์ฝ”๋“œ๋ฅผ ์›ํ•˜๊ฑฐ๋‚˜, ์ƒˆ๋กœ์šด ๋ฒ„์ „์ด ๋‚˜์˜ฌ ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆด ์ˆ˜ ์—†๋‹ค๋ฉด [๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์†Œ์Šค์—์„œ ๋ฐ”๋กœ ์„ค์น˜](https://huggingface.co/docs/transformers/ko/installation#install-from-source)ํ•˜์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.
### conda๋กœ ์„ค์น˜ํ•˜๊ธฐ
๐Ÿค— Transformers๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด conda๋กœ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
```shell script
conda install conda-forge::transformers
```
> **_๋…ธํŠธ:_** `huggingface` ์ฑ„๋„์—์„œ `transformers`๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ฒƒ์€ ์‚ฌ์šฉ์ด ์ค‘๋‹จ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
Flax, PyTorch, TensorFlow ์„ค์น˜ ํŽ˜์ด์ง€์—์„œ ์ด๋“ค์„ conda๋กœ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ํ™•์ธํ•˜์„ธ์š”.
> **_๋…ธํŠธ:_** ์œˆ๋„์šฐ ํ™˜๊ฒฝ์—์„œ ์บ์‹ฑ์˜ ์ด์ ์„ ์œ„ํ•ด ๊ฐœ๋ฐœ์ž ๋ชจ๋“œ๋ฅผ ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ์—ฌ๋Ÿฌ๋ถ„์—๊ฒŒ ์žˆ์–ด์„œ ์„ ํƒ์ด ์•„๋‹Œ ํ•„์ˆ˜๋ผ๋ฉด [์ด ์ด์Šˆ](https://github.com/huggingface/huggingface_hub/issues/1062)๋ฅผ ํ†ตํ•ด ์•Œ๋ ค์ฃผ์„ธ์š”.
## ๋ชจ๋ธ ๊ตฌ์กฐ
**๐Ÿค— Transformers๊ฐ€ ์ œ๊ณตํ•˜๋Š” [๋ชจ๋“  ๋ชจ๋ธ ์ฒดํฌํฌ์ธํŠธ](https://huggingface.co/models)** ๋Š” huggingface.co [๋ชจ๋ธ ํ—ˆ๋ธŒ](https://huggingface.co/models)์— ์™„๋ฒฝํžˆ ์—ฐ๋™๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. [๊ฐœ์ธ](https://huggingface.co/users)๊ณผ [๊ธฐ๊ด€](https://huggingface.co/organizations)์ด ๋ชจ๋ธ ํ—ˆ๋ธŒ์— ์ง์ ‘ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
ํ˜„์žฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ชจ๋ธ ์ฒดํฌํฌ์ธํŠธ์˜ ๊ฐœ์ˆ˜: ![](https://img.shields.io/endpoint?url=https://huggingface.co/api/shields/models&color=brightgreen)
๐Ÿค— Transformers๋Š” ๋‹ค์Œ ๋ชจ๋ธ๋“ค์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค: ๊ฐ ๋ชจ๋ธ์˜ ์š”์•ฝ์€ [์—ฌ๊ธฐ](https://huggingface.co/docs/transformers/ko/model_summary)์„œ ํ™•์ธํ•˜์„ธ์š”.
๊ฐ ๋ชจ๋ธ์ด Flax, PyTorch, TensorFlow์œผ๋กœ ๊ตฌํ˜„๋˜์—ˆ๋Š”์ง€ ๋˜๋Š” ๐Ÿค— Tokenizers ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์ง€์›ํ•˜๋Š” ํ† ํฌ๋‚˜์ด์ €๋ฅผ ์‚ฌ์šฉํ•˜๋Š”์ง€ ํ™•์ธํ•˜๋ ค๋ฉด, [์ด ํ‘œ](https://huggingface.co/docs/transformers/ko/index#supported-framework)๋ฅผ ํ™•์ธํ•˜์„ธ์š”.
์ด ๊ตฌํ˜„์€ ์—ฌ๋Ÿฌ ๋ฐ์ดํ„ฐ๋กœ ๊ฒ€์ฆ๋˜์—ˆ๊ณ  (์˜ˆ์‹œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”) ์˜ค๋ฆฌ์ง€๋„ ๊ตฌํ˜„์˜ ์„ฑ๋Šฅ๊ณผ ๊ฐ™์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค. [๋„ํ๋จผํŠธ](https://github.com/huggingface/transformers/tree/main/examples)์˜ Examples ์„น์…˜์—์„œ ์„ฑ๋Šฅ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ์„ค๋ช…์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## ๋” ์•Œ์•„๋ณด๊ธฐ
| ์„น์…˜ | ์„ค๋ช… |
|-|-|
| [๋„ํ๋จผํŠธ](https://huggingface.co/transformers/ko/) | ์ „์ฒด API ๋„ํ๋จผํŠธ์™€ ํŠœํ† ๋ฆฌ์–ผ |
| [๊ณผ์ œ ์š”์•ฝ](https://huggingface.co/docs/transformers/ko/task_summary) | ๐Ÿค— Transformers๊ฐ€ ์ง€์›ํ•˜๋Š” ๊ณผ์ œ๋“ค |
| [์ „์ฒ˜๋ฆฌ ํŠœํ† ๋ฆฌ์–ผ](https://huggingface.co/docs/transformers/ko/preprocessing) | `Tokenizer` ํด๋ž˜์Šค๋ฅผ ์ด์šฉํ•ด ๋ชจ๋ธ์„ ์œ„ํ•œ ๋ฐ์ดํ„ฐ ์ค€๋น„ํ•˜๊ธฐ |
| [ํ•™์Šต๊ณผ ํŒŒ์ธ ํŠœ๋‹](https://huggingface.co/docs/transformers/ko/training) | ๐Ÿค— Transformers๊ฐ€ ์ œ๊ณตํ•˜๋Š” ๋ชจ๋ธ PyTorch/TensorFlow ํ•™์Šต ๊ณผ์ •๊ณผ `Trainer` API์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ |
| [ํ€ต ํˆฌ์–ด: ํŒŒ์ธ ํŠœ๋‹/์‚ฌ์šฉ ์Šคํฌ๋ฆฝํŠธ](https://github.com/huggingface/transformers/tree/main/examples) | ๋‹ค์–‘ํ•œ ๊ณผ์ œ์—์„œ ๋ชจ๋ธ์„ ํŒŒ์ธ ํŠœ๋‹ํ•˜๋Š” ์˜ˆ์‹œ ์Šคํฌ๋ฆฝํŠธ |
| [๋ชจ๋ธ ๊ณต์œ  ๋ฐ ์—…๋กœ๋“œ](https://huggingface.co/docs/transformers/ko/model_sharing) | ์ปค๋ฎค๋‹ˆํ‹ฐ์— ํŒŒ์ธ ํŠœ๋‹๋œ ๋ชจ๋ธ์„ ์—…๋กœ๋“œ ๋ฐ ๊ณต์œ ํ•˜๊ธฐ |
## ์ธ์šฉ
๐Ÿค— Transformers ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ธ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด, ์ด [๋…ผ๋ฌธ](https://aclanthology.org/2020.emnlp-demos.6/)์„ ์ธ์šฉํ•ด ์ฃผ์„ธ์š”:
```bibtex
@inproceedings{wolf-etal-2020-transformers,
title = "Transformers: State-of-the-Art Natural Language Processing",
author = "Thomas Wolf and Lysandre Debut and Victor Sanh and Julien Chaumond and Clement Delangue and Anthony Moi and Pierric Cistac and Tim Rault and Rรฉmi Louf and Morgan Funtowicz and Joe Davison and Sam Shleifer and Patrick von Platen and Clara Ma and Yacine Jernite and Julien Plu and Canwen Xu and Teven Le Scao and Sylvain Gugger and Mariama Drame and Quentin Lhoest and Alexander M. Rush",
booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
month = oct,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2020.emnlp-demos.6/",
pages = "38--45"
}
```