File size: 25,560 Bytes
0e9a03e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<!---
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.
-->

<!---
A useful guide for English-Traditional Japanese translation of Hugging Face documentation
- Use square quotes, e.g.,「匕甚」

Dictionary

API: API(翻蚳しない)
add: 远加
checkpoint: チェックポむント
code: コヌド
community: コミュニティ
confidence: 信頌床
dataset: デヌタセット
documentation: ドキュメント
example: 䟋
finetune: 埮調敎
Hugging Face: Hugging Face(翻蚳しない)
implementation: 実装
inference: 掚論
library: ラむブラリ
module: モゞュヌル
NLP/Natural Language Processing: NLPず衚瀺される堎合は翻蚳されず、Natural Language Processingず衚瀺される堎合は翻蚳される
online demos: オンラむンデモ
pipeline: pipeline(翻蚳しない)
pretrained/pretrain: 孊習枈み
Python data structures (e.g., list, set, dict): リスト、セット、ディクショナリず蚳され、括匧内は原文英語
repository: repository(翻蚳しない)
summary: 抂芁
token-: token-(翻蚳しない)
Trainer: Trainer(翻蚳しない)
transformer: transformer(翻蚳しない)
tutorial: チュヌトリアル
user: ナヌザ
-->

<p align="center">
    <br>
    <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers_logo_name.png" width="400"/>
    <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> |
        <a href="https://github.com/huggingface/transformers/blob/main/i18n/README_ko.md">한국얎</a> |
        <a href="https://github.com/huggingface/transformers/blob/main/i18n/README_es.md">Español</a> |
        <b>日本語</b> |
        <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_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> |
    </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以䞊の蚀語に察応しおいたす。
* 🖌 画像分類、物䜓怜出、セグメンテヌションなどのタスクのための画像。
* 🗣 音声は、音声認識や音声分類などのタスクに䜿甚したす。

トランスフォヌマヌモデルは、テヌブル質問応答、光孊文字認識、スキャン文曞からの情報抜出、ビデオ分類、芖芚的質問応答など、**耇数のモダリティを組み合わせた**タスクも実行可胜です。

🀗Transformersは、䞎えられたテキストに察しおそれらの事前孊習されたモデルを玠早くダりンロヌドしお䜿甚し、あなた自身のデヌタセットでそれらを埮調敎し、私たちの[model hub](https://huggingface.co/models)でコミュニティず共有するためのAPIを提䟛したす。同時に、アヌキテクチャを定矩する各Pythonモゞュヌルは完党にスタンドアロンであり、迅速な研究実隓を可胜にするために倉曎するこずができたす。

🀗Transformersは[Jax](https://jax.readthedocs.io/en/latest/)、[PyTorch](https://pytorch.org/)、[TensorFlow](https://www.tensorflow.org/)ずいう3倧ディヌプラヌニングラむブラリヌに支えられ、それぞれのラむブラリをシヌムレスに統合しおいたす。片方でモデルを孊習しおから、もう片方で掚論甚にロヌドするのは簡単なこずです。

## オンラむンデモ

[model hub](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によるセマンティックセグメンテヌション](https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512)
- [DETRによるパノプティックセグメンテヌション](https://huggingface.co/facebook/detr-resnet-50-panoptic)

オヌディオにお:
- [Wav2Vec2による自動音声認識](https://huggingface.co/facebook/wav2vec2-base-960h)
- [Wav2Vec2によるキヌワヌド怜玢](https://huggingface.co/superb/wav2vec2-base-superb-ks)

マルチモヌダルなタスクにお:
- [ViLTによる芖芚的質問応答](https://huggingface.co/dandelin/vilt-b32-finetuned-vqa)

Hugging Faceチヌムによっお䜜られた **[トランスフォヌマヌを䜿った曞き蟌み](https://transformer.huggingface.co)** は、このリポゞトリのテキスト生成機胜の公匏デモである。

## Hugging Faceチヌムによるカスタム・サポヌトをご垌望の堎合

<a target="_blank" href="https://huggingface.co/support">
    <img alt="HuggingFace Expert Acceleration Program" src="https://cdn-media.huggingface.co/marketing/transformers/new-support-improved.png" style="max-width: 600px; border: 1px solid #eee; border-radius: 4px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);">
</a><br>

## クむックツアヌ

䞎えられた入力テキスト、画像、音声、...に察しおすぐにモデルを䜿うために、我々は`pipeline`ずいうAPIを提䟛しおおりたす。pipelineは、孊習枈みのモデルず、そのモデルの孊習時に䜿甚された前凊理をグルヌプ化したものです。以䞋は、肯定的なテキストず吊定的なテキストを分類するためにpipelineを䜿甚する方法です:

```python
>>> from transformers import pipeline

# Allocate a pipeline for sentiment-analysis
>>> classifier = pipeline('sentiment-analysis')
>>> classifier('We are very happy to introduce pipeline to the transformers repository.')
[{'label': 'POSITIVE', 'score': 0.9996980428695679}]
```

2行目のコヌドでは、pipelineで䜿甚される事前孊習枈みモデルをダりンロヌドしおキャッシュし、3行目では䞎えられたテキストに察しおそのモデルを評䟡したす。ここでは、答えは99.97%の信頌床で「ポゞティブ」です。

自然蚀語凊理だけでなく、コンピュヌタビゞョンや音声凊理においおも、倚くのタスクにはあらかじめ蚓緎された`pipeline`が甚意されおいる。䟋えば、画像から怜出された物䜓を簡単に抜出するこずができる:

``` python
>>> import requests
>>> from PIL import Image
>>> from transformers import pipeline

# Download an image with cute cats
>>> 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)

# Allocate a pipeline for object detection
>>> 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/task_summary)では、`pipeline`APIでサポヌトされおいるタスクに぀いお詳しく説明しおいたす。

`pipeline`に加えお、䞎えられたタスクに孊習枈みのモデルをダりンロヌドしお䜿甚するために必芁なのは、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)
```

トヌクナむザは孊習枈みモデルが期埅するすべおの前凊理を担圓し、単䞀の文字列 (䞊蚘の䟋のように) たたはリストに察しお盎接呌び出すこずができたす。これは䞋流のコヌドで䜿甚できる蟞曞を出力したす。たた、単玔に ** 匕数展開挔算子を䜿甚しおモデルに盎接枡すこずもできたす。

モデル自䜓は通垞の[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/training)では、このようなモデルを埓来のPyTorchやTensorFlowの孊習ルヌプに統合する方法や、私たちの`Trainer`APIを䜿っお新しいデヌタセットで玠早く埮調敎を行う方法に぀いお説明したす。

## なぜtransformersを䜿う必芁があるのでしょうか

1. 䜿いやすい最新モデル:
    - 自然蚀語理解・生成、コンピュヌタビゞョン、オヌディオの各タスクで高いパフォヌマンスを発揮したす。
    - 教育者、実務者にずっおの䜎い参入障壁。
    - 孊習するクラスは3぀だけで、ナヌザが盎面する抜象化はほずんどありたせん。
    - 孊習枈みモデルを利甚するための統䞀されたAPI。

1. 䜎い蚈算コスト、少ないカヌボンフットプリント:
    - 研究者は、垞に再トレヌニングを行うのではなく、トレヌニングされたモデルを共有するこずができたす。
    - 実務家は、蚈算時間や生産コストを削枛するこずができたす。
    - すべおのモダリティにおいお、60,000以䞊の事前孊習枈みモデルを持぀数倚くのアヌキテクチャを提䟛したす。

1. モデルのラむフタむムのあらゆる郚分で適切なフレヌムワヌクを遞択可胜:
    - 3行のコヌドで最先端のモデルをトレヌニング。
    - TF2.0/PyTorch/JAXフレヌムワヌク間で1぀のモデルを自圚に移動させる。
    - 孊習、評䟡、生産に適したフレヌムワヌクをシヌムレスに遞択できたす。

1. モデルやサンプルをニヌズに合わせお簡単にカスタマむズ可胜:
    - 原著者が発衚した結果を再珟するために、各アヌキテクチャの䟋を提䟛しおいたす。
    - モデル内郚は可胜な限り䞀貫しお公開されおいたす。
    - モデルファむルはラむブラリずは独立しお利甚するこずができ、迅速な実隓が可胜です。

## なぜtransformersを䜿っおはいけないのでしょうか

- このラむブラリは、ニュヌラルネットのためのビルディングブロックのモゞュヌル匏ツヌルボックスではありたせん。モデルファむルのコヌドは、研究者が远加の抜象化/ファむルに飛び蟌むこずなく、各モデルを玠早く反埩できるように、意図的に远加の抜象化でリファクタリングされおいたせん。
- å­Šç¿’APIはどのようなモデルでも動䜜するわけではなく、ラむブラリが提䟛するモデルで動䜜するように最適化されおいたす。䞀般的な機械孊習のルヌプには、別のラむブラリ(おそらく[Accelerate](https://huggingface.co/docs/accelerate))を䜿甚する必芁がありたす。
- 私たちはできるだけ倚くの䜿甚䟋を玹介するよう努力しおいたすが、[examples フォルダ](https://github.com/huggingface/transformers/tree/main/examples) にあるスクリプトはあくたで䟋です。あなたの特定の問題に察しおすぐに動䜜するわけではなく、あなたのニヌズに合わせるために数行のコヌドを倉曎する必芁があるこずが予想されたす。

## むンストヌル

### pipにお

このリポゞトリは、Python 3.9+, Flax 0.4.1+, PyTorch 2.1+, TensorFlow 2.6+ でテストされおいたす。

🀗Transformersは[仮想環境](https://docs.python.org/3/library/venv.html)にむンストヌルする必芁がありたす。Pythonの仮想環境に慣れおいない堎合は、[ナヌザヌガむド](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)を確認しおください。

たず、䜿甚するバヌゞョンのPythonで仮想環境を䜜成し、アクティベヌトしたす。

その埌、Flax, PyTorch, TensorFlowのうち少なくずも1぀をむンストヌルする必芁がありたす。
[TensorFlowむンストヌルペヌゞ](https://www.tensorflow.org/install/)、[PyTorchむンストヌルペヌゞ](https://pytorch.org/get-started/locally/#start-locally)、[Flax](https://github.com/google/flax#quick-install)、[Jax](https://github.com/google/jax#installation)むンストヌルペヌゞで、お䜿いのプラットフォヌム別のむンストヌルコマンドを参照しおください。

これらのバック゚ンドのいずれかがむンストヌルされおいる堎合、🀗Transformersは以䞋のようにpipを䜿甚しおむンストヌルするこずができたす:

```bash
pip install transformers
```

もしサンプルを詊したい、たたはコヌドの最先端が必芁で、新しいリリヌスを埅おない堎合は、[ラむブラリを゜ヌスからむンストヌル](https://huggingface.co/docs/transformers/installation#installing-from-source)する必芁がありたす。

### condaにお

🀗Transformersは以䞋のようにcondaを䜿っお蚭眮するこずができたす:

```shell script
conda install conda-forge::transformers
```

> **_泚意:_**  `huggingface` チャンネルから `transformers` をむンストヌルするこずは非掚奚です。

Flax、PyTorch、TensorFlowをcondaでむンストヌルする方法は、それぞれのむンストヌルペヌゞに埓っおください。

> **_泚意:_**  Windowsでは、キャッシュの恩恵を受けるために、デベロッパヌモヌドを有効にするよう促されるこずがありたす。このような堎合は、[このissue](https://github.com/huggingface/huggingface_hub/issues/1062)でお知らせください。

## モデルアヌキテクチャ

🀗Transformersが提䟛する **[党モデルチェックポむント](https://huggingface.co/models)** は、[ナヌザヌ](https://huggingface.co/users)や[組織](https://huggingface.co/organizations)によっお盎接アップロヌドされるhuggingface.co [model hub](https://huggingface.co)からシヌムレスに統合されおいたす。

珟圚のチェックポむント数: ![](https://img.shields.io/endpoint?url=https://huggingface.co/api/shields/models&color=brightgreen)

🀗Transformersは珟圚、以䞋のアヌキテクチャを提䟛しおいたす: それぞれのハむレベルな芁玄は[こちら](https://huggingface.co/docs/transformers/model_summary)を参照しおください.

各モデルがFlax、PyTorch、TensorFlowで実装されおいるか、🀗Tokenizersラむブラリに支えられた関連トヌクナむザを持っおいるかは、[この衚](https://huggingface.co/docs/transformers/index#supported-frameworks)を参照しおください。

これらの実装はいく぀かのデヌタセットでテストされおおり(サンプルスクリプトを参照)、オリゞナルの実装の性胜ず䞀臎するはずである。性胜の詳现は[documentation](https://github.com/huggingface/transformers/tree/main/examples)のExamplesセクションで芋るこずができたす。


## さらに詳しく

| セクション | 抂芁 |
|-|-|
| [ドキュメント](https://huggingface.co/docs/transformers/) | 完党なAPIドキュメントずチュヌトリアル |
| [タスク抂芁](https://huggingface.co/docs/transformers/task_summary) | 🀗Transformersがサポヌトするタスク |
| [前凊理チュヌトリアル](https://huggingface.co/docs/transformers/preprocessing) | モデル甚のデヌタを準備するために`Tokenizer`クラスを䜿甚 |
| [トレヌニングず埮調敎](https://huggingface.co/docs/transformers/training) | PyTorch/TensorFlowの孊習ルヌプず`Trainer`APIで🀗Transformersが提䟛するモデルを䜿甚 |
| [クむックツアヌ: 埮調敎/䜿甚方法スクリプト](https://github.com/huggingface/transformers/tree/main/examples) | 様々なタスクでモデルの埮調敎を行うためのスクリプト䟋 |
| [モデルの共有ずアップロヌド](https://huggingface.co/docs/transformers/model_sharing) | 埮調敎したモデルをアップロヌドしおコミュニティで共有する |
| [マむグレヌション](https://huggingface.co/docs/transformers/migration) | `pytorch-transformers`たたは`pytorch-pretrained-bert`から🀗Transformers に移行する |

## 匕甚

🀗 トランスフォヌマヌラむブラリに匕甚できる[論文](https://www.aclweb.org/anthology/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://www.aclweb.org/anthology/2020.emnlp-demos.6",
    pages = "38--45"
}
```